vcpkg/ports/botan/arm64-windows.patch
Nursultan Zarlyk 5843d817ec
[botan] Add arm64-windows support (#26156)
* Fix botan:arm64-windows

* Add version

* Add no support for arm-uwp

* Fix SHA for botan

Co-authored-by: Nursultan Zarlyk <nzarlyk@microsoft.com>
2022-08-05 23:35:40 -07:00

24 lines
736 B
Diff

diff --git a/src/lib/utils/mul128.h b/src/lib/utils/mul128.h
index 8cdaae2..54bb670 100644
--- a/src/lib/utils/mul128.h
+++ b/src/lib/utils/mul128.h
@@ -39,10 +39,15 @@ namespace Botan {
#elif defined(BOTAN_BUILD_COMPILER_IS_MSVC) && defined(BOTAN_TARGET_CPU_HAS_NATIVE_64BIT)
#include <intrin.h>
-#pragma intrinsic(_umul128)
-
-#define BOTAN_FAST_64X64_MUL(a,b,lo,hi) \
+#if defined(_M_ARM64)
+ #pragma intrinsic(__umulh)
+ #define BOTAN_FAST_64X64_MUL(a,b,lo,hi) \
+ do { *lo = a * b; *hi = __umulh(a, b); } while(0)
+#else
+ #pragma intrinsic(_umul128)
+ #define BOTAN_FAST_64X64_MUL(a,b,lo,hi) \
do { *lo = _umul128(a, b, hi); } while(0)
+#endif
#elif defined(BOTAN_USE_GCC_INLINE_ASM)