Skip to main content

Module bits

Module bits 

Source
Expand description

Bitvector<N> and Bitlist<N> — bit-packed homogeneous boolean storage.

Both use big-endian bit packing within each byte: bit i of the logical bitstream is stored at bytes[i / 8] & (1 << (i % 8)).

  • Bitvector<N> has length exactly N, takes (N + 7) / 8 bytes; any bits beyond N in the final byte must be zero.
  • Bitlist<N> has variable length up to N. The wire form appends a sentinel 1 bit immediately after the data bits; the decoder finds the highest set bit in the final byte to recover the length.

Structs§

Bitlist
SSZ Bitlist with a compile-time bit cap of N.
Bitvector
SSZ Bitvector with a compile-time length of N bits.