[PATCH v3 4/6] shell32/autocomplete: Re-arrange some fields for better packing

Gabriel Ivăncescu gabrielopcode at gmail.com
Thu Sep 27 07:45:44 CDT 2018


On Thu, Sep 27, 2018 at 2:18 PM, Alexandre Julliard <julliard at winehq.org> wrote:
>
> It's a gratuitous change, and in many cases would generate worse code
> because of the need to manipulate bits. Losing a couple of padding bytes
> here and there is not a problem that needs fixing.
>
> --
> Alexandre Julliard
> julliard at winehq.org

Originally I didn't use bit fields, only converted them to BOOLEAN (1
byte so all 3 along with UCHAR fit in just one 4-byte block).

I was suggested to use bit fields, and it makes sense in this context
so I think it's okay -- booleans on bit fields are efficient (only one
instruction), there's no unpacking that has to be done and so on.
(this only applies to 1-bit bit fields, i.e. booleans or flags)

Of course this is totally minor but I even taking minor into account,
despite this the minor CPU cache improvements outweight it, probably.
Lastly, this opens up easier expansion into more boolean flags into
the future (if needed) instead of having to use bitwise operators and
#define.

Sorry for long explanation, just want to give my reasoning.



More information about the wine-devel mailing list