Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

Commit

Permalink
fix: use wrapping_mul where overflow is expected
Browse files Browse the repository at this point in the history
  • Loading branch information
shuklaayush committed Dec 2, 2023
1 parent d368267 commit 4bec17d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/primefield/src/lib.nr
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use dep::std;
use dep::std::println;

use dep::biguint::{BigUint56, utils};
Expand Down Expand Up @@ -196,7 +197,7 @@ impl PrimeField {

let mut carry2 = 0;
for i in 0..NUM_LIMBS {
let k = tmp[i] * PrimeField::P_INV();
let k = std::wrapping_mul(tmp[i], PrimeField::P_INV());
let mut carry = 0;
for j in 0..NUM_LIMBS {
let (prod, c) = utils::mac(tmp[i + j], k, modulus.limbs[j], carry);
Expand Down

0 comments on commit 4bec17d

Please sign in to comment.