Generally, when dealing with bit fields, the size/layout is entirely up to the compiler.
The reason for the odd structure sizes is in fact because the underlying type (unsigned long long
vs unsigned char
) is different, so the compiler won't try to merge the bit-fields. When they're all unsigned long long
, the compiler can merge them into a single 8-byte quantity. Thus, there's really no workaround except to change everything to unsigned long long
.