Skip to content

Commit 579999b

Browse files
committed
scalar: adjust muladd2 to new int128 interface
1 parent b160486 commit 579999b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/scalar_4x64_impl.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,10 @@ static int secp256k1_scalar_cond_negate(secp256k1_scalar *r, int flag) {
254254
#define muladd2(a,b) { \
255255
uint64_t tl, th, th2, tl2; \
256256
{ \
257-
uint128_t t = (uint128_t)a * b; \
258-
th = t >> 64; /* at most 0xFFFFFFFFFFFFFFFE */ \
259-
tl = t; \
257+
secp256k1_uint128 t; \
258+
secp256k1_u128_mul(&t, a, b); \
259+
th = secp256k1_u128_hi_u64(&t); /* at most 0xFFFFFFFFFFFFFFFE */ \
260+
tl = secp256k1_u128_to_u64(&t); \
260261
} \
261262
th2 = th + th; /* at most 0xFFFFFFFFFFFFFFFE (in case th was 0x7FFFFFFFFFFFFFFF) */ \
262263
c2 += (th2 < th); /* never overflows by contract (verified the next line) */ \

0 commit comments

Comments
 (0)