Skip to content

Commit

Permalink
Use shifts instead of mul/div by 2 in Toom-3
Browse files Browse the repository at this point in the history
  • Loading branch information
cuviper committed Mar 14, 2021
1 parent c528be1 commit bc967f6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/biguint/multiplication.rs
Expand Up @@ -312,10 +312,10 @@ fn mac3(mut acc: &mut [BigDigit], mut b: &[BigDigit], mut c: &[BigDigit]) {
//
// This particular sequence is given by Bodrato and is an interpolation
// of the above equations.
let mut comp3: BigInt = (r3 - &r1) / 3;
let mut comp1: BigInt = (r1 - &r2) / 2;
let mut comp3: BigInt = (r3 - &r1) / 3u32;
let mut comp1: BigInt = (r1 - &r2) >> 1;
let mut comp2: BigInt = r2 - &r0;
comp3 = (&comp2 - comp3) / 2 + &r4 * 2;
comp3 = ((&comp2 - comp3) >> 1) + (&r4 << 1);
comp2 += &comp1 - &r4;
comp1 -= &comp3;

Expand Down

0 comments on commit bc967f6

Please sign in to comment.