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.
2 parents 9e5d86c + f8492f3 commit 3382b0eCopy full SHA for 3382b0e
src/curve25519.rs
@@ -1405,12 +1405,6 @@ fn equal(b: u8, c: u8) -> i32 {
1405
1406
1407
1408
-fn negative(b: i8) -> u8 {
1409
- let mut x = (b as i64) as u64;
1410
- x >>= 63; /* 1: yes; 0: no */
1411
- x as u8
1412
-}
1413
-
1414
impl GePrecomp {
1415
fn zero() -> GePrecomp {
1416
GePrecomp {
@@ -1427,7 +1421,7 @@ impl GePrecomp {
1427
1421
}
1428
1422
1429
1423
pub fn select(pos: usize, b: i8) -> GePrecomp {
1430
- let bnegative: u8 = negative(b);
1424
+ let bnegative = (b as u8) >> 7;
1431
1425
let babs: u8 = (b - (((-(bnegative as i8)) & b) << 1)) as u8;
1432
1426
let mut t = GePrecomp::zero();
1433
t.maybe_set(&GE_PRECOMP_BASE[pos][0], equal(babs, 1));
0 commit comments