Skip to main content

byte_encode

Function byte_encode 

Source
pub fn byte_encode(d: usize, f: &[u16; 256], out: &mut [u8])
Expand description

Bit-pack 256 integers into 32*d bytes (Algorithm 5: ByteEncode_d).

Each of the 256 coefficients in f is encoded using d bits. For d < 12, coefficients are treated modulo 2^d. For d = 12, coefficients are treated modulo q = 3329.

§Arguments

  • d - The bit-width per coefficient (1..=12).
  • f - Array of 256 unsigned 16-bit coefficients.
  • out - Output buffer of exactly 32 * d bytes.

§Panics

Debug-asserts that out.len() == 32 * d.