diff --git a/Changelog.rst b/Changelog.rst index 39202ec8..138c6e6e 100644 --- a/Changelog.rst +++ b/Changelog.rst @@ -7,6 +7,7 @@ Changelog New features --------------- * Added support for DER BOOLEAN encodings. +* The library now compiles on Windows ARM64. Thanks to Niyas Sait. Resolved issues --------------- diff --git a/src/multiply.h b/src/multiply.h index f7bc2e5f..75cd448b 100644 --- a/src/multiply.h +++ b/src/multiply.h @@ -15,10 +15,18 @@ oh = (uint64_t)(pr >> 64); \ } while (0) -#elif defined(_MSC_VER) && defined(_WIN64) +#elif defined(_MSC_VER) && (defined(_M_X64) || defined(__x86_64__)) -#include -#define DP_MULT(a,b,ol,oh) do { ol = UnsignedMultiply128(a,b,&oh); } while (0) +#include +#define DP_MULT(a,b,ol,oh) do { ol = _umul128(a,b,&oh); } while (0) + +#elif defined(_MSC_VER) && defined(_M_ARM64) + +#include +#define DP_MULT(a,b,ol,oh) do { \ + ol = ((uint64_t)(a))*(b); \ + oh = __umulh(a, b); \ +} while (0) #else diff --git a/src/multiply_64.c b/src/multiply_64.c index e9d51761..cb34ff1f 100644 --- a/src/multiply_64.c +++ b/src/multiply_64.c @@ -38,7 +38,7 @@ /** * Add a 64-bit value x to y/sum_mid/sum_hi */ -#if defined(_WIN64) && (_MSC_VER>=1900) +#if defined(_MSC_VER) && (_MSC_VER>=1900) && (defined(_M_X64) || defined(__x86_64__)) #include #define ADD192(y, x) do { \