Allocation of bitfields is very compiler-dependent. Some compilers allocate the bits first from right (LSByte) to left (MSByte), and others allocate from left to right. Also, alignment and byte or word crossing of bitfields is not implemented consistently. Some possibilities are to:
- Check the different allocation strategies,
- Check if there is an option to change the allocation strategy in the compiler, or
- Use the compiler defines to hold sources portable:
-
__BITFIELD_LSBIT_FIRST__
-
__BITFIELD_MSBIT_FIRST__
-
__BITFIELD_LSBYTE_FIRST__
-
__BITFIELD_MSBYTE_FIRST__
-
__BITFIELD_LSWORD_FIRST__
-
__BITFIELD_MSWORD_FIRST__
-
__BITFIELD_TYPE_SIZE_REDUCTION__
-
__BITFIELD_NO_TYPE_SIZE_REDUCTION__