|
|
@ -22,6 +22,16 @@ void imult64() {
|
|
|
|
|
|
|
|
|
|
|
|
#include "safemult.h"
|
|
|
|
#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 imult64(int64 a,int64 b,int64* c) {
|
|
|
|
int neg=(a<0);
|
|
|
|
int neg=(a<0);
|
|
|
|
uint64 d;
|
|
|
|
uint64 d;
|
|
|
@ -34,3 +44,5 @@ int imult64(int64 a,int64 b,int64* c) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|