Expand description
Numbers bit-packed in lanes: what a frame’s list of ints is made of.
A list of n numbers width bits each (1..=32) is n / GROUP groups,
then the rest packed one after another (little-endian bits). A group is
GROUP numbers in LANES lanes of 32-bit words: number j goes to
lane j % LANES, the j / LANES-th in it; a lane’s numbers are packed
one after another into its words, and word k of lane l is the group’s
k * LANES + l-th. A row of LANES numbers is shifted and merged as one
256-bit vector, so packing and unpacking run a group at a time — with the
best instruction set the processor has (Backend: SSE4.2, AVX2, AVX-512,
NEON), chosen once at start; the same bytes whichever. Numbers wider than 32 bits go one after another, no groups.
Number i is found in O(1) (get), so views read in place.
Enums§
- Backend
- An instruction set that packs and unpacks groups. Every backend writes and reads the same bytes; they differ only in speed.
Constants§
- GROUP
- Numbers in a group.
- GROUP_
MAX_ BITS - The widest numbers packed in groups.
- LANES
- Lanes of a group: a 256-bit vector of 32-bit words.
Functions§
- get
- Number
iofbytes(nnumbers,widthbits each) —i < n. - group_
bytes - A group’s bytes, its numbers
widthbits each. - pack
- Packs
items(nof them, each fittingwidthbits) ontoout. - packed_
bytes - The bytes
nnumberswidthbits each take. - unpack
- Each of the
nnumbers inbytes(widthbits each), in order, tof.