Use __shiftright128 intrinsic in secp256k1_u128_rshift on MSVC

This commit is contained in:
Hennadii Stepanov 2023-06-04 15:51:44 +01:00
parent 60556c9f49
commit 5b7bf2e9d4
No known key found for this signature in database
GPG Key ID: 410108112E7EA81F

View File

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