Index Mathematics Conjectures nbv lettuce Widgets

from_bits

stdlib/bits/from_bits.nbv

from_bits(bits)

combine little-endian bits into a single element works for both static and witness bits

Calls
inner_prod
Precompiles
len!, loop!
Used by
bits/add32_bits, dilithium/lattice/lattice_permutation, dilithium/mldsa/mldsa44_verify_static, dilithium/mldsa/mldsa44_w_approx, dilithium/mldsa/mldsa44_w_approx_static, lattice/lattice_bits, mersenne61/mldsa/mldsa44_w_approx, mersenne61/mldsa/mldsa_intt, mersenne61/mldsa/mldsa_pointwise, mersenne61/mldsa/mldsa_reduce, milli/mldsa/mldsa44_w_approx, milli/mldsa/mldsa_reduce, mldsa/mldsa44_parse, mldsa/mldsa44_parse_sig, mldsa/mldsa_brv8, mldsa/mldsa_hint_unpack, mldsa/mldsa_limbs, mldsa/mldsa_sample_in_ball, mldsa/mldsa_use_hint, typed/typed_lex_chacha

Source

# combine little-endian bits into a single element
# works for both static and witness bits
(bits)

static n = len! bits
static mut pows[n]
static mut pow = 1
loop! n, i {
  pows[i] = pow
  pow = pow * 2
}

inner_prod(bits, pows)