Skip to content

Commit 5b7bf2e

Browse files
committed
Use __shiftright128 intrinsic in secp256k1_u128_rshift on MSVC
1 parent 60556c9 commit 5b7bf2e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/int128_struct_impl.h

+5
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,12 @@ static SECP256K1_INLINE void secp256k1_u128_rshift(secp256k1_uint128 *r, unsigne
8080
r->lo = r->hi >> (n-64);
8181
r->hi = 0;
8282
} else if (n > 0) {
83+
#if defined(_MSC_VER) && defined(_M_X64)
84+
VERIFY_CHECK(n < 64);
85+
r->lo = __shiftright128(r->lo, r->hi, n);
86+
#else
8387
r->lo = ((1U * r->hi) << (64-n)) | r->lo >> n;
88+
#endif
8489
r->hi >>= n;
8590
}
8691
}

0 commit comments

Comments
 (0)