Skip to content

Commit

Permalink
Improve projective mul by scalar perf
Browse files Browse the repository at this point in the history
  • Loading branch information
tcoratger authored and xJonathanLEI committed Mar 27, 2024
1 parent 5de6c2d commit a3c22c3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions starknet-curve/src/ec_point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ impl ops::Mul<&[bool]> for &AffinePoint {
#[allow(clippy::suspicious_arithmetic_impl)]
fn mul(self, rhs: &[bool]) -> Self::Output {
let mut product = AffinePoint::identity();
for b in rhs.iter().rev() {
for b in rhs.iter().rev().skip_while(|b| !*b) {
product.double_assign();
if *b {
product += self;
Expand Down Expand Up @@ -284,7 +284,7 @@ impl ops::Mul<&[bool]> for &ProjectivePoint {
#[allow(clippy::suspicious_arithmetic_impl)]
fn mul(self, rhs: &[bool]) -> Self::Output {
let mut product = ProjectivePoint::identity();
for b in rhs.iter().rev() {
for b in rhs.iter().rev().skip_while(|b| !*b) {
product.double_assign();
if *b {
product += self;
Expand Down

0 comments on commit a3c22c3

Please sign in to comment.