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

Alexandre Julliard julliard at winehq.org
Thu Sep 27 08:08:14 CDT 2018


Gabriel Ivăncescu <gabrielopcode at gmail.com> writes:

> 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.

The basic rule is that you don't make changes unless there's a
reason. When things are simply a matter of taste and either way works
fine, the existing code should be left alone.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list