diff options
| author | Fernando S <fsahmkow27@gmail.com> | 2022-06-30 12:38:50 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-30 12:38:50 +0200 |
| commit | ee5d112e192ddbbedf066dfd6554914231aa278e (patch) | |
| tree | 8b6b2f943bbf2fc749dbe144eee26cd144c084c9 /src/common/uint128.h | |
| parent | 801409b5ac28f3d4b5db2da14017fa8ad0025e13 (diff) | |
| parent | 3adeb694b0f55b97701e9233255460300c2ebad0 (diff) | |
Merge pull request #7454 from FernandoS27/new-core-timing
Core: Remake Core Timing
Diffstat (limited to 'src/common/uint128.h')
| -rw-r--r-- | src/common/uint128.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/common/uint128.h b/src/common/uint128.h index f890ffec24..199d0f55e0 100644 --- a/src/common/uint128.h +++ b/src/common/uint128.h @@ -31,12 +31,17 @@ namespace Common { return _udiv128(r[1], r[0], d, &remainder); #endif #else +#ifdef __SIZEOF_INT128__ + const auto product = static_cast<unsigned __int128>(a) * static_cast<unsigned __int128>(b); + return static_cast<u64>(product / d); +#else const u64 diva = a / d; const u64 moda = a % d; const u64 divb = b / d; const u64 modb = b % d; return diva * b + moda * divb + moda * modb / d; #endif +#endif } // This function multiplies 2 u64 values and produces a u128 value; |
