add non-asm version for gcc

master
leitner 16 years ago
parent 25912d79cb
commit 3629bfd5a7

@ -1,4 +1,4 @@
#ifdef __x86_64__ #if defined(__x86_64__) && defined(__OPTIMIZE__)
/* WARNING: this only works if compiled with -fomit-frame-pointer */ /* WARNING: this only works if compiled with -fomit-frame-pointer */
void imult64() { void imult64() {

@ -21,6 +21,16 @@ void umult64() {
#include "safemult.h" #include "safemult.h"
#ifdef __GNUC__
int umult64(uint64 a,uint64 b,uint64* c) {
__uint128_t x=((__uint128_t)a)*b;
if ((*c=(uint64)x) != x) return 0;
return 1;
}
#else
/* return 1 for overflow, 0 for ok */ /* return 1 for overflow, 0 for ok */
int umult64(uint64 a,uint64 b,uint64* c) { int umult64(uint64 a,uint64 b,uint64* c) {
uint32 ahi=a>>32; uint32 ahi=a>>32;
@ -46,3 +56,5 @@ int umult64(uint64 a,uint64 b,uint64* c) {
} }
#endif #endif
#endif

Loading…
Cancel
Save