slip_placements
stdlib/slip/slip_placements.nbv
slip_placements(static mask, static n, static c)
place the entries of a masked sequence into blocks (dags BitMask::placements): entries with mask 0 fill the decomposed blocks and entries with mask 1 the as-is blocks, each in order, with n columns per block. Blocks of the as-is region are numbered after the c decomposed blocks. Returns the block and column of every entry.
- Precompiles
div_floor!,if_eq!,len!,loop!,modulo!- Used by
slip/slip_r1cs_arg_verify
Source
# place the entries of a masked sequence into blocks (dags BitMask::placements):
# entries with mask 0 fill the decomposed blocks and entries with mask 1 the
# as-is blocks, each in order, with `n` columns per block. Blocks of the as-is
# region are numbered after the `c` decomposed blocks. Returns the block and
# column of every entry.
(static mask, static n, static c)
static mask_len = len! mask
static mut block[mask_len]
static mut col[mask_len]
static mut decomposed = 0
static mut as_is = 0
loop! mask_len, i {
if_eq! mask[i], 0 {
block[i] = div_floor! decomposed, n
col[i] = modulo! decomposed, n
decomposed = decomposed + 1
}
if_eq! mask[i], 1 {
block[i] = c + (div_floor! as_is, n)
col[i] = modulo! as_is, n
as_is = as_is + 1
}
}
(block, col)