Implements a bitfield abstraction. May be used in a union with other bitfields.
More...
template<unsigned offset, unsigned size, typename Storage>
struct kblib::bitfield< offset, size, Storage >
Implements a bitfield abstraction. May be used in a union with other bitfields.
In C++20, [[no_unique_address]] will enable a better implementation which will work in non-union structs, as long as no two bitfields name the same exact bits. ([[no_unique_address]] allows empty objects of different types to be allocated at the same location, but distinct objects of the same type must have distinct addresses, [[no_unique_address]] notwithstanding. This does not apply to unions, though.)
- Template Parameters
-
offset | The number of bits less significant than the bitfield. |
size | The number of bits constituting this bitfield. |
Storage | The underlying type which stores the bits. |
Definition at line 437 of file bits.h.