mirror of
https://github.com/jwinterm/aeon.git
synced 2026-10-18 05:11:27 +02:00
clean up portable 128-bit multiply
This commit is contained in:
@@ -45,25 +45,10 @@ namespace cryptonote {
|
||||
using std::uint64_t;
|
||||
using std::vector;
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#include <windows.h>
|
||||
#include <winnt.h>
|
||||
|
||||
static inline void mul(uint64_t a, uint64_t b, uint64_t &low, uint64_t &high) {
|
||||
low = mul128(a, b, &high);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static inline void mul(uint64_t a, uint64_t b, uint64_t &low, uint64_t &high) {
|
||||
typedef unsigned __int128 uint128_t;
|
||||
uint128_t res = (uint128_t) a * (uint128_t) b;
|
||||
low = (uint64_t) res;
|
||||
high = (uint64_t) (res >> 64);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static inline bool cadd(uint64_t a, uint64_t b) {
|
||||
return a + b < a;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user