Skip to main content

pack_indices_from_iter

Function pack_indices_from_iter 

Source
pub fn pack_indices_from_iter(
    indices: impl ExactSizeIterator<Item = u32>,
    bits: u8,
) -> Box<[u64]>
Expand description

Packs indices from an iterator into a compact bit array using power-of-2 bit widths, without an intermediate buffer.

The entry count is taken from the iterator’s ExactSizeIterator length, so the caller cannot desync the packed width from the packed data.

§Arguments

  • indices - The indices to pack (values must fit in bits bits)
  • bits - Bits per entry (must be 1, 2, 4, 8, or 16)

§Panics

Panics if bits is not a power of 2 or is greater than 16.