Index Mathematics Conjectures nbv lettuce Widgets

to_bits_static!

The little-endian bits of a static scalar, as wide as the field. Bits and bytes

to_bits_static! v

Decomposes the canonical integer of a static scalar into field_bit_width! bits, least significant first (32 bits in the milli field). Take a prefix with slice_from_start for a narrower width, or use to_bits_exact_static, which also checks that the value fits.

Arguments

v
Static scalar.

Returns

A static vector of field_bit_width! bits. Expression form only.

Constraints

None.

Example

(let x)
static bits = slice_from_start((to_bits_static! 6), 4)
x + bits

Notes

Errors: input must be a scalar and, for witness inputs, input must be a static value, use to_bits_unconstrained for witness values. The width depends on the field (23 bits in the dilithium field), so code shared between fields should not slice more bits than the narrowest field has; u32_bits_static builds 32-bit words from 16-bit halves for that reason.

Used in the standard library

bits/lte_negone, bits/to_bits_exact_static, mldsa/mldsa_brv8, mldsa/mldsa_expand_a, mldsa/mldsa_static_limbs, polynomial/bit_reverse_indices, polynomial/poly_norm_l1