mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-17 07:44:40 +00:00
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>