summaryrefslogtreecommitdiff
path: root/src/common/uint128.h
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2021-11-23 03:29:00 +0100
committerGravatar Fernando Sahmkow2022-06-28 01:06:48 +0200
commit096366ead51345bcd170e31b6160b14aaf73e996 (patch)
treedb99c0d032466f4bd94871baaecf0544fec82f25 /src/common/uint128.h
parentMerge pull request #8504 from comex/mesosphere-current-process (diff)
downloadyuzu-096366ead51345bcd170e31b6160b14aaf73e996.tar.gz
yuzu-096366ead51345bcd170e31b6160b14aaf73e996.tar.xz
yuzu-096366ead51345bcd170e31b6160b14aaf73e996.zip
Common: improve native clock.
Diffstat (limited to '')
-rw-r--r--src/common/uint128.h5
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 {
31 return _udiv128(r[1], r[0], d, &remainder); 31 return _udiv128(r[1], r[0], d, &remainder);
32#endif 32#endif
33#else 33#else
34#ifdef __SIZEOF_INT128__
35 const auto product = static_cast<unsigned __int128>(a) * static_cast<unsigned __int128>(b);
36 return static_cast<u64>(product / d);
37#else
34 const u64 diva = a / d; 38 const u64 diva = a / d;
35 const u64 moda = a % d; 39 const u64 moda = a % d;
36 const u64 divb = b / d; 40 const u64 divb = b / d;
37 const u64 modb = b % d; 41 const u64 modb = b % d;
38 return diva * b + moda * divb + moda * modb / d; 42 return diva * b + moda * divb + moda * modb / d;
39#endif 43#endif
44#endif
40} 45}
41 46
42// This function multiplies 2 u64 values and produces a u128 value; 47// This function multiplies 2 u64 values and produces a u128 value;