Wide Bit Fields

An on-off bit field is pretty common; you’ll find them all over. Also common are wide bit fields, which can hold values greater than one or zero. These wide bit fields are often mixed with single-bit fields making for a wonderful stew of binary data all held within a single integer value.
Continue reading

Bit Field Manipulation

The three basic bit manipulation operations are:

  • Set a bit (change its value to 1)
  • Reset a bit (change its value to 0)
  • Read a bit (determine whether it’s 1 or 0)

The standard C library lacks specific functions to carry out these bit manipulations, and I haven’t checked to see whether a third party library is available. That’s because you can easily code these operations on your own.
Continue reading