|
|
@ -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
|
|
|
|