halo2_ecc/bigint/big_less_than.rs
1use super::ProperUint;
2use halo2_base::{gates::RangeInstructions, utils::ScalarField, AssignedValue, Context};
3
4// given OverflowInteger<F>'s `a` and `b` of the same shape,
5// returns whether `a < b`
6pub fn assign<F: ScalarField>(
7 range: &impl RangeInstructions<F>,
8 ctx: &mut Context<F>,
9 a: impl Into<ProperUint<F>>,
10 b: impl Into<ProperUint<F>>,
11 limb_bits: usize,
12 limb_base: F,
13) -> AssignedValue<F> {
14 // a < b iff a - b has underflow
15 let (_, underflow) = super::sub::assign(range, ctx, a, b, limb_bits, limb_base);
16 underflow
17}