Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Bit-fields can be used to allow flags or other integer values with small ranges to be packed together to save storage space. When used in structure members, bit fields can improve storage efficiency. Compilers will typically allocate consecutive bit-field structure members to the same int-sized dword, as long as they fit into that completely into that dword. However, the order of allocation within a dword is implementation dependent. Some implementations are "right-to-left": the first member occupies the low-order position of the dword. Others are "left-to-right": the first member occupies the high-order position of the dword. Calculations that depend on the order bits within a dword may produce different results on different calculations on different implementations.

...