Question says it all.
If I have this for a 96-bit field:
uint32_t flags[3]; //(thanks @jalf!)
How do I best go about accessing this, given that my subfields therein may lie over the 32-bit boundaries (eg. a field that runs from bit 29 to 35)?
I need my accesses to be as fast as possible, so I’d rather not iterate over them as 32-bit elements of an array.
[This answer is valid for C (and by extension, for C++ as well).]
The platform-independent way is to apply bit-masks and bit-shifts as appropriate.
So to get your field from 29 to 35 (inclusive):
Obviously, you could write a class/function/macro to automate this.