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