Module storage_proofs_core::gadgets::insertion
source · Expand description
Insertion Permutation
Insert an AllocatedNum
into a sequence of AllocatedNums
at an arbitrary position.
This can be thought of as a generalization of AllocatedNum::conditionally_reverse
and reduces to it in the binary case.
Functions§
- Insert
element
after the nth 1-indexed element ofelements
, wherepath_bits
represents n, least-significant bit first. The returned result contains a new vector ofAllocatedNum
s withelement
inserted, and constraints are enforced.elements.len() + 1
must be a power of two. - Takes two allocated numbers (
a
,b
) and returnsa
if the condition is true, andb
otherwise. - Select the nth element of
from
, wherepath_bits
represents n, least-significant bit first. The returned result contains the selected element, and constraints are enforced.from.len()
must be a power of two.