Open BenjaminLawson opened 1 year ago
This should actually be pretty easy. bits
and struct
views are actually generated almost identically, with a templated backing storage. MakeStructView()
just constructs and passes in a ContiguousBuffer
.
MakeBitsViewOfInt()
could construct and pass BitBlock<IntBuffer>
, where IntBuffer
is a new class with the same interface as BigEndianByteOrderer
, LittleEndianByteOrderer
, and NullByteOrderer
-- just a few trivial methods.
Technically you could do this right now in user code, but that use is only quasi-supported -- I always intended to allow user-defined storage, but I haven't documented or stabilized the interfaces yet.
It would be nice if the C++ generated code supported MakeBitsView() types with uint backing storage. We often need to save bitmasks from packet views as integers/enums for passing around in our code. We then need to do bitmasking later without Emboss, which often requires creating new C++ enums. One thing to consider is that we may want the backing storage to have host endianness.