We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
tmp
1 parent eb0437e commit f54d357Copy full SHA for f54d357
soroban-sdk/src/crypto/bls12_381.rs
@@ -25,6 +25,8 @@ pub struct Bls12_381 {
25
// https://github.com/arkworks-rs/algebra/blob/bf1c9b22b30325ef4df4f701dedcb6dea904c587/ff/src/biginteger/arithmetic.rs#L66-L79
26
fn sbb_for_sub_with_borrow(a: &mut u64, b: u64, borrow: u8) -> u8 {
27
let tmp = (1u128 << 64) + u128::from(*a) - u128::from(b) - u128::from(borrow);
28
+ // casting is safe here because `tmp` can only exceed u64 by a single
29
+ // (borrow) bit, which we capture in the next line.
30
*a = tmp as u64;
31
u8::from(tmp >> 64 == 0)
32
}
0 commit comments