cast truncates bits from constant value (8000000000000000 becomes 0)

Geoff Levand geoffrey.levand at am.sony.com
Sat Dec 2 08:17:08 EST 2006


Linus Torvalds wrote:
> Btw, try this stupid program, to see just how _strange_ gcc enums are.. A 
> sizeof of the enum is not the same as the size of the individual entries. 

Yes, interesting.  I think your comment regarding compatibility with other
compilers is the convincing one.

Another way is to change the encoding of the value such that it fits into
the range of an enum.  For this particular case, the values are actually
for a field in the high 3 bits, so I can just do the shift when the value
is used.

-Geoff




More information about the Linuxppc-dev mailing list