On 23 Oct 2010, at 10:24 PM, Jeff Trawick wrote:
No; this is a dis-optimization. You have added int-bitmath cpu
cycles
to a simple int test, without gaining any storage. Huh?
Are you sure?
I would expect a compiler optimiser to do the most appropriate
thing, and it
gets us out of the habit of allocating an int or a char every time
we need a
boolean flag.
It can't reorder fields, and pointers and integers need to be on
"natural" boundaries for performance (or even outright functionality
on some platforms). So there will be padding after the bit.
Some Intel ABI spec would show alignment requirements for a notable
example platform, absent of any packing pragmas.
I was referring specifically to the "int-bitmath cpu cycles". Any data
size smaller than the bus width involves an AND at least, just to
isolate the byte or int. It's been a while since I was doing pure
assembly, but would be surprised if this was slower.
Regards,
Graham
--