From 1346d9830aee4834d7409f0c9f94928a5da51edb Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Tue, 3 Oct 2017 09:19:50 +0200 Subject: [PATCH 1/3] there's no __int128 on MSVC, fall back to 32bit MPI's --- tommath.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tommath.h b/tommath.h index 591076e..5523ad0 100644 --- a/tommath.h +++ b/tommath.h @@ -26,6 +26,11 @@ extern "C" { #endif +/* MS Visual C++ doesn't have a 128bit type for words, so fall back to 32bit MPI's (where words are 64bit) */ +#if defined(_MSC_VER) +# define MP_32BIT +#endif + /* detect 64-bit mode if possible */ #if defined(__x86_64__) || defined(_M_X64) || defined(_M_AMD64) || \ defined(__powerpc64__) || defined(__ppc64__) || defined(__PPC64__) || \ @@ -63,9 +68,7 @@ typedef uint32_t mp_word; #elif defined(MP_64BIT) /* for GCC only on supported platforms */ typedef uint64_t mp_digit; -# if defined(_WIN32) -typedef unsigned __int128 mp_word; -# elif defined(__GNUC__) +# if defined(__GNUC__) typedef unsigned long mp_word __attribute__((mode(TI))); # else /* it seems you have a problem From d1fc4a71d363667df7359f77524d3c45cbe549b7 Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Tue, 3 Oct 2017 15:18:33 +0200 Subject: [PATCH 2/3] LLP64 indicates a windows environment as of [1] the only architecture using a LLP64 data model is windows [1]: https://en.wikipedia.org/wiki/64-bit_computing --- tommath.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tommath.h b/tommath.h index 5523ad0..0119906 100644 --- a/tommath.h +++ b/tommath.h @@ -27,7 +27,7 @@ extern "C" { #endif /* MS Visual C++ doesn't have a 128bit type for words, so fall back to 32bit MPI's (where words are 64bit) */ -#if defined(_MSC_VER) +#if defined(_MSC_VER) || defined(__LLP64__) # define MP_32BIT #endif From a40e32b21c8716186c8940c6bbba07a8039c402d Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Tue, 10 Oct 2017 14:30:01 +0200 Subject: [PATCH 3/3] suppress some warnings when compiling with mingw-gcc [skip ci] --- makefile_include.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/makefile_include.mk b/makefile_include.mk index 3a599e8..45a4895 100644 --- a/makefile_include.mk +++ b/makefile_include.mk @@ -60,6 +60,9 @@ endif # COMPILE_DEBUG ifneq ($(findstring clang,$(CC)),) CFLAGS += -Wno-typedef-redefinition -Wno-tautological-compare -Wno-builtin-requires-header endif +ifneq ($(findstring mingw,$(CC)),) +CFLAGS += -Wno-shadow +endif ifeq ($(PLATFORM), Darwin) CFLAGS += -Wno-nullability-completeness endif