Skip to content

Add uint8_t support to bit-oriented APIs - #206

Merged
wangxiao1254 merged 1 commit into
mainfrom
fix/byte-bool-api
Aug 23, 2026
Merged

wangxiao1254 merged 1 commit into
mainfrom
fix/byte-bool-api

Conversation

@wangxiao1254

Copy link
Copy Markdown
Member

Summary

Add first-class uint8_t byte-bool buffers to the bit-oriented APIs that previously accepted only bool*.

This removes type-punning at call sites while preserving the existing packed representation, PRG consumption, and zero-length behavior.

Changes

  • add uint8_t overloads for bools_to_bits and bits_to_bools;
  • add byte-bool output to PRG::random_bool using the same implementation and block schedule as bool output;
  • add byte-bool IOChannel::send_bool / recv_bool with the same packed wire format;
  • accept byte selectors in F2K inner products and GaloisFieldPacking;
  • update benchmarks to pass byte storage through typed APIs instead of casting it to bool*;
  • document the input/output convention: zero is false, nonzero is true, and produced byte-bools are normalized to 0 or 1.

Compatibility

The existing bool* APIs remain unchanged. The constrained byte overloads also preserve unambiguous null, zero-length calls.

Wire bytes are identical between bool and uint8_t representations.

Tests

  • clean Apple Clang 17 Release/Ninja build: 88/88 build steps;
  • full CTest suite: 52/52 passed;
  • focused test_block, test_f2k, test_prg, and test_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.

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
wangxiao1254 marked this pull request as ready for review August 23, 2026 02:20
@wangxiao1254
wangxiao1254 merged commit bd036a9 into main Aug 23, 2026
22 checks passed
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.

1 participant