Open
Conversation
I'm not sure if I like this feature, so I'm keeping it off the main branch for now and will consider adding it in later.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'm not sure if I like this feature, so I'm keeping it off the main branch for now and will consider adding it in later if folks convince me otherwise.
This allows you to re-order bits in a bitfield before it is parsed. So if you have a bitfield like this:
0-4: Lower 4 bits of uint8 field
4-11: Padding
12-15: Upper 4 bits of uint8 field
You can create a bitfield like this:
The
reorder_bitsoption in the configuration will reorder the bits like this:So that field
ain the bitfield is parsed all at once.At first glance this feature seemed nice, but in practice it got a little ugly and error-prone. In general, I think it's a better idea to just read the bitfield as is, (with an
a_loweranda_upperfield) and then combine them when you convert from bitfield -> domain object in your code (so use the bitfield object similar to how you'd work with an ORM object -- useful for IO, but confined to the edges of your system)