Codec Variants

svb provides five codec variants spanning three element widths. Each is a zero-sized type implementing the same encode/decode surface.

VariantElementTag bitsByte widthsWire-compatible with
Svb16u1611/2ONT vbz_hdf_plugin
U32Classicu3221/2/3/4Lemire C library, stream-vbyte crate
U32Variant0124u3220/1/2/4Lemire "0124" variant
U64Coder1234u6421/2/3/4streamvbyte64::Coder1234 (u32 values)
U64Coder1248u6421/2/4/8streamvbyte64::Coder1248

Tag encoding

All u32 and u64 codecs pack four 2-bit tags into each control byte, LSB-first:

control byte n
bits 1:0  → tag for value 4n+0
bits 3:2  → tag for value 4n+1
bits 5:4  → tag for value 4n+2
bits 7:6  → tag for value 4n+3

Svb16 uses 1-bit tags and packs eight tags per control byte.

Buffer layout

All codecs use the same flat layout: control bytes first, data bytes immediately after.

[ ctrl[0] ctrl[1] ... ctrl[ceil(n/4)-1] | data bytes ... ]

The control stream length is always ceil(n / 4) bytes for 2-bit codecs, ceil(n / 8) for Svb16. No length prefix is stored; the caller supplies the element count to decode.