Browse Source

add non-asm version for gcc

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

2
mult/imult64.c

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

12
mult/umult64.c

@ -21,6 +21,16 @@ void umult64() {
#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 */
int umult64(uint64 a,uint64 b,uint64* c) {
uint32 ahi=a>>32;
@ -46,3 +56,5 @@ int umult64(uint64 a,uint64 b,uint64* c) {
}
#endif
#endif

Loading…
Cancel
Save