Skip to content

Commit 7fa27b6

Browse files
committed
bigint::monty: simplify redc return value
1 parent 5708db0 commit 7fa27b6

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
@@ -81,14 +81,13 @@ fn monty_redc(a: BigUint, mr: &MontyReducer) -> BigUint {
8181

8282
// 4: R <- C * β^(-n)
8383
// This is an n-word bitshift, equivalent to skipping n words.
84-
let r : Vec<u32> = c.iter().skip(n_size).cloned().collect();
85-
let ret = BigUint::new(r);
84+
let ret = BigUint::new(c[n_size..].to_vec());
8685

8786
// 5: if R >= β^n then return R-N else return R.
8887
if &ret < mr.p {
8988
ret
9089
} else {
91-
&ret-mr.p
90+
ret - mr.p
9291
}
9392
}
9493

0 commit comments

Comments
 (0)