Skip to content

Conversation

@mortbopet
Copy link
Contributor

To not constrain ESI C++ serialization to integer types that fit in cstdint types (<64 bits) as well as to allow non-byte aligned fields (e.g. structs with boolean values), this PR introduces the ESI BitVector type. It is a view on top of a std::span<const uint8_t> which tracks a byte- and bit index, and providing a bitvector view onto that bytearray.
Deserialization has then been refactored to use such a BitVector view to pop values off of an incoming MessageData.

For serialization, we introduce MutableBitVector, which inherits from BitVector, but also owns the underlying byte array. This then allows for mutation operators to be implemented, facilitating serialization (e.g. shift-and-or style).

Finally, to support arbitrary-width integers, Int and UInt classes have been introduces. These contain constructors for their respective cstdint value, as well as conversion operators to cstdint classes. They do not contain arithmetic operators. Partly motivated by keeping this PR small, partly motivated by not being needed in the immediate usecase that this PR is motivated by.

@mortbopet mortbopet requested a review from teqdruid as a code owner October 23, 2025 12:01
@mortbopet
Copy link
Contributor Author

@mortbopet mortbopet force-pushed the dev/mpetersen/esi_values branch from ad56edd to 6d476a5 Compare October 23, 2025 13:43
@mortbopet mortbopet merged commit d8f7678 into main Oct 23, 2025
8 checks passed
@mortbopet mortbopet deleted the dev/mpetersen/esi_values branch October 23, 2025 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants