From: Rémi Bernon rbernon@codeweavers.com
--- include/msvcrt/intrin.h | 4 ++++ include/winnt.h | 12 ++++++++++++ 2 files changed, 16 insertions(+)
diff --git a/include/msvcrt/intrin.h b/include/msvcrt/intrin.h index 03d856c5933..1be630b5753 100644 --- a/include/msvcrt/intrin.h +++ b/include/msvcrt/intrin.h @@ -94,6 +94,10 @@ unsigned __int64 __getReg(int); unsigned __int64 _umul128(unsigned __int64,unsigned __int64,unsigned __int64*); #endif
+#if defined(_MSC_VER) && defined(__x86_64__) +unsigned __int64 __shiftright128(unsigned __int64,unsigned __int64,unsigned char); +#endif + #ifdef __cplusplus } #endif diff --git a/include/winnt.h b/include/winnt.h index 794970a35f5..667be50b17f 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -7411,6 +7411,18 @@ static FORCEINLINE DWORD64 UnsignedMultiply128( DWORD64 a, DWORD64 b, DWORD64 *h #define _umul128 UnsignedMultiply128 #endif
+#if defined(_MSC_VER) && !defined(__arm64ec__) && (!defined(__clang__) || __has_builtin(__shiftright128)) +#define ShiftRight128 __shiftright128 +DWORD64 __shiftright128(DWORD64,DWORD64,BYTE); +#pragma intrinsic(__shiftright128) +#elif !defined(__i386__) +static FORCEINLINE DWORD64 ShiftRight128( DWORD64 lo, DWORD64 hi, BYTE shift ) +{ + return ((unsigned __int128)hi << 64 | lo) >> shift; +} +#define __shiftright128 ShiftRight128 +#endif + #ifdef __cplusplus } #endif