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 of elements
, where path_bits
represents n, least-significant bit first.
The returned result contains a new vector of AllocatedNum
s with element
inserted, and constraints are enforced.
elements.len() + 1
must be a power of two.
Takes two allocated numbers (a
, b
) and returns a
if the condition is true, and b
otherwise.
Select the nth element of from
, where path_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.