We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0a898b1 commit 69dec3fCopy full SHA for 69dec3f
src/modular/div_by_2.rs
@@ -36,13 +36,15 @@ pub(crate) mod boxed {
36
pub(crate) fn div_by_2(a: &BoxedUint, modulus: &BoxedUint) -> BoxedUint {
37
debug_assert_eq!(a.bits_precision(), modulus.bits_precision());
38
39
- let (half, is_odd) = a.shr1_with_carry();
+ let (mut half, is_odd) = a.shr1_with_carry();
40
let half_modulus = modulus.shr1();
41
42
let if_odd = half
43
.wrapping_add(&half_modulus)
44
.wrapping_add(&BoxedUint::one_with_precision(a.bits_precision()));
45
46
- BoxedUint::ct_select(&half, &if_odd, is_odd)
+ half.ct_assign(&if_odd, is_odd);
47
+
48
+ half
49
}
50
0 commit comments