Browse Source

perf(scalar_mul_le): use add_mixed for tail bits

pull/1/head
Youssef El Housni 2 months ago
parent
commit
e6bcd582aa
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      src/groups/curves/short_weierstrass/mod.rs

+ 4
- 4
src/groups/curves/short_weierstrass/mod.rs

@ -359,10 +359,10 @@ where
for bit in proj_bits.iter().rev().skip(1).rev() {
if bit.is_constant() {
if *bit == &Boolean::TRUE {
*mul_result += &multiple_of_power_of_two.into_projective();
*mul_result = mul_result.add_mixed(&multiple_of_power_of_two)?;
}
} else {
let temp = &*mul_result + &multiple_of_power_of_two.into_projective();
let temp = mul_result.add_mixed(&multiple_of_power_of_two)?;
*mul_result = bit.select(&temp, &mul_result)?;
}
multiple_of_power_of_two.double_in_place()?;
@ -374,10 +374,10 @@ where
if n >= 1 {
if proj_bits[n - 1].is_constant() {
if proj_bits[n - 1] == &Boolean::TRUE {
*mul_result += &multiple_of_power_of_two.into_projective();
*mul_result = mul_result.add_mixed(&multiple_of_power_of_two)?;
}
} else {
let temp = &*mul_result + &multiple_of_power_of_two.into_projective();
let temp = mul_result.add_mixed(&multiple_of_power_of_two)?;
*mul_result = proj_bits[n - 1].select(&temp, &mul_result)?;
}
}

Loading…
Cancel
Save