Merge bitcoin-core/secp256k1#1250: No need to subtract 1 before doing a right shift

3e43041be6 No need to subtract 1 before doing a right shift (roconnor-blockstream)

Pull request description:

ACKs for top commit:
  real-or-random:
    utACK 3e43041be6
  jonasnick:
    ACK 3e43041be6

Tree-SHA512: bcecda11eae3fb845bef7af88c6171bedcd933872d08a9849c0a250cb6c9e982a88bd45e8a8364a4a348f8be413fc91ee04cf8fa78adae44e584e3ad7ec544cf
This commit is contained in:
Jonas Nick 2023-03-28 06:30:27 +00:00
commit 1d8f367515
No known key found for this signature in database
GPG Key ID: 4861DBF262123605
1 changed files with 1 additions and 1 deletions

View File

@ -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