I plan to implement bitfields support in Cstruct library. And I wonder on what syntax is best and probably an API, maybe there are already some good examples of OCaml libraries that work with bit-level data? If you ask - why not to just aggregate bits into bytes, there are two problems:
If you don’t align bitfields, all members can be shifted across byte boundary to be read directly
Changing the way to read/write in case of different endianess