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 -#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)