Merge pull request #91 from libtom/fix/microsoft_build

there's no __int128 on MSVC, fall back to 32bit MPI's
This commit is contained in:
Steffen Jaeckel 2017-10-10 14:30:51 +02:00 committed by GitHub
commit 7800276855
2 changed files with 9 additions and 3 deletions

View File

@ -60,6 +60,9 @@ endif # COMPILE_DEBUG
ifneq ($(findstring clang,$(CC)),) ifneq ($(findstring clang,$(CC)),)
CFLAGS += -Wno-typedef-redefinition -Wno-tautological-compare -Wno-builtin-requires-header CFLAGS += -Wno-typedef-redefinition -Wno-tautological-compare -Wno-builtin-requires-header
endif endif
ifneq ($(findstring mingw,$(CC)),)
CFLAGS += -Wno-shadow
endif
ifeq ($(PLATFORM), Darwin) ifeq ($(PLATFORM), Darwin)
CFLAGS += -Wno-nullability-completeness CFLAGS += -Wno-nullability-completeness
endif endif

View File

@ -26,6 +26,11 @@
extern "C" { extern "C" {
#endif #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) || defined(__LLP64__)
# define MP_32BIT
#endif
/* detect 64-bit mode if possible */ /* detect 64-bit mode if possible */
#if defined(__x86_64__) || defined(_M_X64) || defined(_M_AMD64) || \ #if defined(__x86_64__) || defined(_M_X64) || defined(_M_AMD64) || \
defined(__powerpc64__) || defined(__ppc64__) || defined(__PPC64__) || \ defined(__powerpc64__) || defined(__ppc64__) || defined(__PPC64__) || \
@ -63,9 +68,7 @@ typedef uint32_t mp_word;
#elif defined(MP_64BIT) #elif defined(MP_64BIT)
/* for GCC only on supported platforms */ /* for GCC only on supported platforms */
typedef uint64_t mp_digit; typedef uint64_t mp_digit;
# if defined(_WIN32) # if defined(__GNUC__)
typedef unsigned __int128 mp_word;
# elif defined(__GNUC__)
typedef unsigned long mp_word __attribute__((mode(TI))); typedef unsigned long mp_word __attribute__((mode(TI)));
# else # else
/* it seems you have a problem /* it seems you have a problem