From 3e43041be68c1288ad9897525a15e21945fb3eb9 Mon Sep 17 00:00:00 2001 From: roconnor-blockstream Date: Mon, 27 Mar 2023 09:29:41 -0400 Subject: [PATCH] No need to subtract 1 before doing a right shift --- src/int128_struct_impl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/int128_struct_impl.h b/src/int128_struct_impl.h index 2eb337cb5483c..cc17bad167519 100644 --- a/src/int128_struct_impl.h +++ b/src/int128_struct_impl.h @@ -193,7 +193,7 @@ static SECP256K1_INLINE int secp256k1_i128_check_pow2(const secp256k1_int128 *r, VERIFY_CHECK(n < 127); VERIFY_CHECK(sign == 1 || sign == -1); return n >= 64 ? r->hi == (uint64_t)sign << (n - 64) && r->lo == 0 - : r->hi == (uint64_t)((sign - 1) >> 1) && r->lo == (uint64_t)sign << n; + : r->hi == (uint64_t)(sign >> 1) && r->lo == (uint64_t)sign << n; } #endif