Files
craft-libs/crates
vangel76andClaude Sonnet 5.5 b25d6e4797 bitstream: one 8-byte load in BitReader::peek, direct read_bit (#516)
peek built its window from five bounds-checked byte loads on every call.
While at least 8 bytes remain it now does one big-endian 8-byte load; the
last 7 bytes and positions past the end keep the old zero-padded byte
loop in a cold function. read_bit reads its byte directly instead of
going through read_bits(1).

Behaviour is unchanged: values, errors and positions are identical,
including peeks near and past the end of the buffer. Tests compare the
reader against a verbatim copy of the previous logic over random
operation sequences, plus the exact edge positions and a bitwise
reference for peek and read_bit.

Closes #516

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-02 21:36:05 +01:00
..
…