Skip to content

Commit

Permalink
Use __shiftright128 intrinsic in secp256k1_u128_rshift on MSVC
Browse files Browse the repository at this point in the history
  • Loading branch information
hebasto committed Jun 4, 2023
1 parent bf29f8d commit 26d0b48
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/int128_struct_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,12 @@ static SECP256K1_INLINE void secp256k1_u128_rshift(secp256k1_uint128 *r, unsigne
r->lo = r->hi >> (n-64);
r->hi = 0;
} else if (n > 0) {
#if defined(_MSC_VER) && defined(_M_X64)
VERIFY_CHECK(n < 64);
r->lo = __shiftright128(r->lo, r->hi, n);
#else
r->lo = ((1U * r->hi) << (64-n)) | r->lo >> n;
#endif
r->hi >>= n;
}
}
Expand Down

0 comments on commit 26d0b48

Please sign in to comment.