The order of allocation of bit fields within an int (§3.5.2.1)
Bit fields are allocated within a 16-bit integer from least-significant to mostsignificant bit. In the following code,
struct mybitfields
{
unsigned a : 4;
unsigned b : 5;
unsigned c : 7;
} test;
void main( void )
{
test.a = 2;
test.b = 31;
test.c = 0;
}
the bits for the integer 0x01F2 would be arranged as follows:
00000001 11110010
cccccccb bbbbaaaa
Since the 80x86 processors store the low byte of integer values before the high byte, the integer 0x01F2 above would be stored in physical memory as 0xF2 followed by 0x01.