diff --git a/mult/imult64.c b/mult/imult64.c index ecf4f30..231ca55 100644 --- a/mult/imult64.c +++ b/mult/imult64.c @@ -22,6 +22,16 @@ void imult64() { #include "safemult.h" +#if defined(__GNUC__) && (defined(__x86_64__) || defined(__ia64__) || defined(__powerpc64__) || defined(__alpha__) || defined(__mips64__) || defined(__sparc64__)) + +int imult64(int64 a,int64 b,int64* c) { + __int128_t x=((__int128_t)a)*b; + if ((*c=(int64)x) != x) return 0; + return 1; +} + +#else + int imult64(int64 a,int64 b,int64* c) { int neg=(a<0); uint64 d; @@ -34,3 +44,5 @@ int imult64(int64 a,int64 b,int64* c) { } #endif + +#endif diff --git a/mult/umult64.c b/mult/umult64.c index d4ecf2c..db72ee2 100644 --- a/mult/umult64.c +++ b/mult/umult64.c @@ -21,7 +21,7 @@ void umult64() { #include "safemult.h" -#ifdef __GNUC__ +#if defined(__GNUC__) && (defined(__x86_64__) || defined(__ia64__) || defined(__powerpc64__) || defined(__alpha__) || defined(__mips64__) || defined(__sparc64__)) int umult64(uint64 a,uint64 b,uint64* c) { __uint128_t x=((__uint128_t)a)*b;