Skip to content

Commit 0ceacb0

Browse files
committed
replace select with conditional_select
1 parent 6ec4cd9 commit 0ceacb0

File tree

2 files changed

+1
-18
lines changed

2 files changed

+1
-18
lines changed

src/uint/boxed/cmp.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,6 @@ use subtle::{
1111
};
1212

1313
impl BoxedUint {
14-
/// Return `b` if `c` is truthy, otherwise return `a`.
15-
#[inline]
16-
pub(crate) fn select(a: &Self, b: &Self, c: ConstChoice) -> Self {
17-
debug_assert_eq!(a.limbs.len(), b.limbs.len());
18-
let mut limbs = vec![Limb::ZERO; a.limbs.len()];
19-
20-
let mut i = 0;
21-
while i < limbs.len() {
22-
limbs[i] = Limb::select(a.limbs[i], b.limbs[i], c);
23-
i += 1;
24-
}
25-
26-
Self {
27-
limbs: limbs.into(),
28-
}
29-
}
30-
3114
/// Returns the truthy value if `self >= rhs` and the falsy value otherwise.
3215
#[inline]
3316
pub(crate) fn gt(lhs: &Self, rhs: &Self) -> ConstChoice {

src/uint/boxed/sqrt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl BoxedUint {
4848
// At this point `x_prev == x_{n}` and `x == x_{n+1}`
4949
// where `n == i - 1 == LOG2_BITS + 1 == floor(log2(BITS)) + 1`.
5050
// Thus, according to Hast, `sqrt(self) = min(x_n, x_{n+1})`.
51-
Self::select(&x_prev, &x, BoxedUint::gt(&x_prev, &x))
51+
Self::conditional_select(&x_prev, &x, Self::gt(&x_prev, &x).into())
5252
}
5353

5454
/// Computes √(`self`)

0 commit comments

Comments
 (0)