bitfield: unify order#12759
Conversation
Currently the bitfield type mixes up the order of bits: While the byte order is big-endian (most significant byte first), the bit order of each single byte within the bitfield is little-endian (most significant bit last). While this isn't a problem for most applications of the bitfield type it becomes one when sending the bitfield over the network (as done e.g. in the [ACKs of Selective Fragment Recovery][SFR-ACKs]). This change unifies byte order and bit order to both be most significant bX first. [SFR-ACKs]: https://tools.ietf.org/html/draft-ietf-6lo-fragment-recovery-07
|
Just for clarification: the issue you are facing only appears when you do a plain |
|
|
Since you are now imposing a strict format of how the bitfield is internally represented, I very much would like to have a specific unit test for that .. to prevent future changes in this module to generate regressions. |
|
Will do. |
|
I didn't notice there were already unittests for |
Added unittests for missing functions and also fixed the existing unittests. |
cgundogan
left a comment
There was a problem hiding this comment.
I am fine with this change. The new behavior is properly documented and unit tests were extended. ACK! No idea why travis fails with a docker error, though ..
|
It's a cppcheck error ;-). The "docker error" is just the |
002678b to
27510b7
Compare
|
Addressed and squashed directly. |
Contribution description
Currently the bitfield type mixes up the order of bits: While the byte order is big-endian (most significant byte first), the bit order of each single byte within the bitfield is little-endian (most significant bit last). While this isn't a problem for most applications of the bitfield type it becomes one when sending the bitfield over the network (as done e.g. in the ACKs of Selective Fragment Recovery).
This change Currently the bitfield type mixes up the order of bits: While the byte order is big-endian (most significant byte first), the bit order of each single byte within the bitfield is little-endian (most significant bit last). While this isn't a problem for most applications of the bitfield type it becomes one when sending the bitfield over the network (as done e.g. in the ACKs of Selective Fragment Recovery).
This change unifies byte order and bit order to both be most significant bX first.
unifies byte order and bit order to both be most significant bX first.
Testing procedure
Users of
bitfield(bloom filters, source address selection for IPv6, lpc2387 GPIO, ...) should still work as expected. I usedbloom's unittests to test:Issues/PRs references
Needed for standard compliance in #12648.