Subject: Re: bug#11082: 24.0.94; u.glyphless member in struct glyph does not fit in 32 bits

From: Andreas Schwab <[email-masked]>
Date: Sat, 24 Mar 2012 09:54:09 +0100

Eli Zaretskii <[email-masked]> writes:

>> The member `u.glyphless' above requires at least 33 bits and does not
>> fit in the size (32 bits) of `u.val' on many environments.  As a
>> result, equality with respect to the `u.val' member (e.g., used in
>> GLYPH_EQUAL_P) does not necessarily mean the equality of glyphless
>> glyphs.

This is broken since GLYPHLESS_GLYPH was added.

> ?? Isn't the size of a union defined by its widest member?

The size of u.val is defined by the size of unsigned.

> If so, we just end up wasting some storage here, but we should never
> truncate a bit field.

It's not about truncation, but about ignored bits in GLYPH_EQUAL_P.

> I would actually suggest to use 22-bit for this field, to avoid
> confusion in the future.

Making the struct exactly 32 bits may be better since it can make access
to the ch member simpler.

Andreas.

-- 
Andreas Schwab, [email-masked]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."