Trait halo2_gadgets::utilities::cond_swap::CondSwapInstructions
source · [−]pub trait CondSwapInstructions<F: FieldExt>: UtilitiesInstructions<F> {
fn swap(
&self,
layouter: impl Layouter<F>,
pair: (Self::Var, Value<F>),
swap: Value<bool>
) -> Result<(Self::Var, Self::Var), Error>;
}
Expand description
Instructions for a conditional swap gadget.
Required Methods
Given an input pair (a,b) and a swap
boolean flag, returns
(b,a) if swap
is set, else (a,b) if swap
is not set.
The second element of the pair is required to be a witnessed value, not a variable that already exists in the circuit.