Skip to content

Commit

Permalink
fix: constraint count regression introduced in commit 53f652b (noir-l…
Browse files Browse the repository at this point in the history
  • Loading branch information
iAmMichaelConnor authored Nov 15, 2024
1 parent 4b34164 commit d81d5fa
Showing 1 changed file with 12 additions and 25 deletions.
37 changes: 12 additions & 25 deletions src/bignum.nr
Original file line number Diff line number Diff line change
Expand Up @@ -212,18 +212,17 @@ where
unconstrained fn __batch_invert<let M: u32>(x: [Self; M]) -> [Self; M] {
let params = Params::get_params();
assert(params.has_multiplicative_inverse);
__batch_invert::<_, MOD_BITS, _>(params, x.map(|bn| Self::get_limbs_slice(bn).as_array()))
.map(|limbs| Self { limbs })
__batch_invert::<_, MOD_BITS, _>(params, x.map(|bn: Self| bn.limbs)).map(|limbs| {
Self { limbs }
})
}

unconstrained fn __batch_invert_slice<let M: u32>(x: [Self]) -> [Self] {
let params = Params::get_params();
assert(params.has_multiplicative_inverse);
__batch_invert_slice::<_, MOD_BITS>(
params,
x.map(|bn| Self::get_limbs_slice(bn).as_array()),
)
.map(|limbs| Self { limbs })
__batch_invert_slice::<_, MOD_BITS>(params, x.map(|bn: Self| bn.limbs)).map(|limbs| {
Self { limbs }
})
}

unconstrained fn __tonelli_shanks_sqrt(self) -> std::option::Option<Self> {
Expand All @@ -243,17 +242,11 @@ where
let params = Params::get_params();
let (q_limbs, r_limbs) = __compute_quadratic_expression::<_, MOD_BITS, _, _, _, _>(
params,
map(
lhs_terms,
|bns| map(bns, |bn| Self::get_limbs_slice(bn).as_array()),
),
map(lhs_terms, |bns| map(bns, |bn: Self| bn.limbs)),
lhs_flags,
map(
rhs_terms,
|bns| map(bns, |bn| Self::get_limbs_slice(bn).as_array()),
),
map(rhs_terms, |bns| map(bns, |bn: Self| bn.limbs)),
rhs_flags,
map(linear_terms, |bn| Self::get_limbs_slice(bn).as_array()),
map(linear_terms, |bn: Self| bn.limbs),
linear_flags,
);
(Self { limbs: q_limbs }, Self { limbs: r_limbs })
Expand All @@ -270,17 +263,11 @@ where
let params = Params::get_params();
evaluate_quadratic_expression::<_, MOD_BITS, _, _, _, _>(
params,
map(
lhs_terms,
|bns| map(bns, |bn| Self::get_limbs_slice(bn).as_array()),
),
map(lhs_terms, |bns| map(bns, |bn: Self| bn.limbs)),
lhs_flags,
map(
rhs_terms,
|bns| map(bns, |bn| Self::get_limbs_slice(bn).as_array()),
),
map(rhs_terms, |bns| map(bns, |bn: Self| bn.limbs)),
rhs_flags,
map(linear_terms, |bn| Self::get_limbs_slice(bn).as_array()),
map(linear_terms, |bn: Self| bn.limbs),
linear_flags,
)
}
Expand Down

0 comments on commit d81d5fa

Please sign in to comment.