Skip to content

Commit 3e9d8c8

Browse files
committed
Use __shiftright128 intrinsic in secp256k1_u128_rshift on MSVC
1 parent bf29f8d commit 3e9d8c8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/int128_struct_impl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@ 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+
r->lo = __shiftright128(r->lo, r->hi, n);
85+
#else
8386
r->lo = ((1U * r->hi) << (64-n)) | r->lo >> n;
87+
#endif
8488
r->hi >>= n;
8589
}
8690
}

0 commit comments

Comments
 (0)