diff options
author | Jack Lloyd <[email protected]> | 2016-07-30 10:01:45 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-07-30 10:01:45 -0400 |
commit | 9ad9a8bec0c8ff43af754e9215d73737d30308ed (patch) | |
tree | ff07f9a9e0e8aac0b278a0a6a44ac967ee9a4420 /src/lib | |
parent | 17677f9981005b68201653b45de42c5958f32b70 (diff) |
Check for __SIZEOF_INT128__ before using TI mode
Otherwise we run into problems on 64-bit CPUs with 32-bit userland.
GH #563
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/utils/mul128.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/lib/utils/mul128.h b/src/lib/utils/mul128.h index bcf5fa7ef..fe533c720 100644 --- a/src/lib/utils/mul128.h +++ b/src/lib/utils/mul128.h @@ -12,13 +12,15 @@ namespace Botan { -// Prefer TI mode over __int128 as GCC rejects the latter in pendantic mode -#if (BOTAN_GCC_VERSION > 440) && defined(BOTAN_TARGET_CPU_HAS_NATIVE_64BIT) +#if defined(__SIZEOF_INT128__) && defined(BOTAN_TARGET_CPU_HAS_NATIVE_64BIT) #define BOTAN_TARGET_HAS_NATIVE_UINT128 - typedef unsigned int uint128_t __attribute__((mode(TI))); -#elif defined(__SIZEOF_INT128__) - #define BOTAN_TARGET_HAS_NATIVE_UINT128 - typedef unsigned __int128 uint128_t; + + // Prefer TI mode over __int128 as GCC rejects the latter in pendantic mode + #if defined(__GNUG__) + typedef unsigned int uint128_t __attribute__((mode(TI))); + #else + typedef unsigned __int128 uint128_t; + #endif #endif } |