Fix #67, remove use of bitfields in CF #103
Merged
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.
Bit field behavior is platform-specific, bits are not specified to be in any particular order. Furthermore, unions of bitfields are likely undefined behavior.
This removes the bitfields and replaces with normal fields.
Fixes #67
NOTE: The cost of doing this is slightly larger data size. I checked the size of the structure before and after to quantify this - the "flags" structure grew by 16 bytes on my dev system (x86-64, gcc 11.2).
The net result is that the memory footprint of the CF global grows by 1600 bytes (due to 100 transactions in default config). However, this is partially mitigated by a slight reduction in code size, of approximately 300 bytes. It probably runs faster too (although I did not quantify that - not as easy to test) but the 300 bytes of extra code were obviously being executed every time these flags were read/written, that adds up.