Skip to content

Commit b380880

Browse files
committed
bigint::monty: simplify modpow zero test
1 parent 96c4a26 commit b380880

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

bigint/src/monty.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use integer::Integer;
2-
use traits::{Zero, One};
2+
use traits::Zero;
33

44
use biguint::BigUint;
55

@@ -116,8 +116,7 @@ pub fn monty_modpow(a: &BigUint, exp: &BigUint, modulus: &BigUint) -> BigUint{
116116
// Binary exponentiation
117117
let mut ans = &r % mr.p;
118118
let mut e = exp.clone();
119-
let zero = Zero::zero();
120-
while e > zero {
119+
while !e.is_zero() {
121120
if e.is_odd() {
122121
ans = monty_mult(ans, &apri, &mr);
123122
}

0 commit comments

Comments
 (0)