Skip to content

Commit

Permalink
Small refactoring in mul mod (#582)
Browse files Browse the repository at this point in the history
  • Loading branch information
tcoratger authored Mar 11, 2024
1 parent 0a7d71a commit 8177e7a
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/uint/mul_mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ impl<const LIMBS: usize> Uint<LIMBS> {
match p.to_odd().into() {
Some(odd_p) => {
let params = MontyParams::new_vartime(odd_p);
let lhs = MontyForm::new(self, params);
let rhs = MontyForm::new(rhs, params);
let ret = lhs * rhs;
ret.retrieve()
(MontyForm::new(self, params) * MontyForm::new(rhs, params)).retrieve()
}
None => todo!("even moduli are currently unsupported"),
}
Expand Down Expand Up @@ -83,9 +80,7 @@ const fn mac_by_limb<const LIMBS: usize>(
let mut carry = carry;

while i < LIMBS {
let (n, c) = a.limbs[i].mac(b.limbs[i], c, carry);
a.limbs[i] = n;
carry = c;
(a.limbs[i], carry) = a.limbs[i].mac(b.limbs[i], c, carry);
i += 1;
}

Expand Down

0 comments on commit 8177e7a

Please sign in to comment.