halo2_ecc/bigint/
negative.rs

1
2
3
4
5
6
7
8
9
10
11
use super::OverflowInteger;
use halo2_base::{gates::GateInstructions, utils::ScalarField, Context};

pub fn assign<F: ScalarField>(
    gate: &impl GateInstructions<F>,
    ctx: &mut Context<F>,
    a: OverflowInteger<F>,
) -> OverflowInteger<F> {
    let out_limbs = a.limbs.into_iter().map(|limb| gate.neg(ctx, limb)).collect();
    OverflowInteger::new(out_limbs, a.max_limb_bits)
}