Here's an idea
Posted Dec 10, 2007 7:40 UTC (Mon) by
jzbiciak (
✭ supporter ✭, #5246)
In reply to:
Here's an idea by jzbiciak
Parent article:
Memory access and alignment
Oh, and bit-fields (that is, fields of somewhat arbitrary bit widths) tend to be based around the size of "int" on a given machine. That is, they tend to be word oriented. The fields pack together to form words, and a field doesn't straddle two words.
Note that I say "tend to." Bit field layout and struct layout are actually ABI issues (ABI == Application Binary Interface). For example, here's the SVR4 i386 ABI. Take a look starting at page 27. In the case of the SVR4 ABI, it appears bitfields are actually packed in terms of their base type. I believe the latest C standard only wants you to use signed int, unsigned int and _Bool, though.
(
Log in to post comments)