Add uint8_t support to bit-oriented APIs - #206
Merged
Merged
Conversation
Accept byte-bool buffers in bit packing, PRG output, packed IOChannel transfers, F2k selectors, and Galois-field packing without casting them to bool pointers. Share implementations with the existing bool overloads. Preserve null-safe zero-length calls, normalize byte-bool output, and keep the bool and uint8_t paths bit-, wire-, and PRG-state-equivalent.
wangxiao1254
marked this pull request as ready for review
August 23, 2026 02:20
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.
Summary
Add first-class
uint8_tbyte-bool buffers to the bit-oriented APIs that previously accepted onlybool*.This removes type-punning at call sites while preserving the existing packed representation, PRG consumption, and zero-length behavior.
Changes
uint8_toverloads forbools_to_bitsandbits_to_bools;PRG::random_boolusing the same implementation and block schedule asbooloutput;IOChannel::send_bool/recv_boolwith the same packed wire format;GaloisFieldPacking;bool*;0or1.Compatibility
The existing
bool*APIs remain unchanged. The constrained byte overloads also preserve unambiguous null, zero-length calls.Wire bytes are identical between
boolanduint8_trepresentations.Tests
test_block,test_f2k,test_prg, andtest_netio: 4/4 passed.Coverage includes boundary lengths and tail preservation, null zero-length calls, nonzero byte inputs, normalized output, PRG position/following-block parity, F2K selector parity, and cross-representation NetIO transfers.
Stack
This is PR 1 of 6 and targets
main.