Browse Source

fix for 32-bit archs

master
Felix von Leitner 13 years ago
parent
commit
88f31eb398
  1. 12
      mult/imult64.c
  2. 2
      mult/umult64.c

12
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

2
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;

Loading…
Cancel
Save