Skip to content

Commit

Permalink
Enable compiling on Windows ARM64 (see GH PR 579)
Browse files Browse the repository at this point in the history
  • Loading branch information
Legrandin committed May 14, 2023
1 parent 09f0ac5 commit 7e9183b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions Changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
---------------
Expand Down
14 changes: 11 additions & 3 deletions src/multiply.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <windows.h>
#define DP_MULT(a,b,ol,oh) do { ol = UnsignedMultiply128(a,b,&oh); } while (0)
#include <intrin.h>
#define DP_MULT(a,b,ol,oh) do { ol = _umul128(a,b,&oh); } while (0)

#elif defined(_MSC_VER) && defined(_M_ARM64)

#include <intrin.h>
#define DP_MULT(a,b,ol,oh) do { \
ol = ((uint64_t)(a))*(b); \
oh = __umulh(a, b); \
} while (0)

#else

Expand Down
2 changes: 1 addition & 1 deletion src/multiply_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <intrin.h>
#define ADD192(y, x) do { \
Expand Down

0 comments on commit 7e9183b

Please sign in to comment.