On 20/02/2024 11:27, Marek Vasut wrote: > On 2/20/24 11:57, Paul Barker wrote: >> On 20/02/2024 08:37, Marek Vasut wrote: >>> This hs400_tuning is a flag, make it bool. No functional change. >>> This will be useful in the following patch, which adds another >>> more generic flag, where the compiler can better use the space >>> now reserved for the u8 to store more flags in it. >> >> The minimum size for a bool is one byte so there likely won't be any >> improvement in struct size from using bool instead of u8 for >> `hs400_tuning` here and `tuning` added in the next patch. I still think >> it's a good change to make though, bool is the right type for an on/off >> flag. > > The compiler does not do boolean packing in structures ?
The compiler will only pack booleans if you explicitly say that only one bit of memory is needed, e.g.: bool tuning:1; bool hs400_tuning:1; Otherwise the assumption is that you may wish to take the address of each field and so each one must have a distinct address in memory. Thanks, -- Paul Barker
OpenPGP_0x27F4B3459F002257.asc
Description: OpenPGP public key
OpenPGP_signature.asc
Description: OpenPGP digital signature