Skip to content

Commit

Permalink
No need to subtract 1 before doing a right shift
Browse files Browse the repository at this point in the history
  • Loading branch information
roconnor-blockstream authored Mar 27, 2023
1 parent 464a911 commit 3e43041
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/int128_struct_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 3e43041

Please sign in to comment.