diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2021-11-23 03:29:00 +0100 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2022-06-28 01:06:48 +0200 |
commit | 096366ead51345bcd170e31b6160b14aaf73e996 (patch) | |
tree | db99c0d032466f4bd94871baaecf0544fec82f25 /src/common/uint128.h | |
parent | Merge pull request #8504 from comex/mesosphere-current-process (diff) | |
download | yuzu-096366ead51345bcd170e31b6160b14aaf73e996.tar yuzu-096366ead51345bcd170e31b6160b14aaf73e996.tar.gz yuzu-096366ead51345bcd170e31b6160b14aaf73e996.tar.bz2 yuzu-096366ead51345bcd170e31b6160b14aaf73e996.tar.lz yuzu-096366ead51345bcd170e31b6160b14aaf73e996.tar.xz yuzu-096366ead51345bcd170e31b6160b14aaf73e996.tar.zst yuzu-096366ead51345bcd170e31b6160b14aaf73e996.zip |
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 f890ffec2..199d0f55e 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; |