From 096366ead51345bcd170e31b6160b14aaf73e996 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Tue, 23 Nov 2021 03:29:00 +0100 Subject: Common: improve native clock. --- src/common/uint128.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/common/uint128.h') 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 @@ -30,6 +30,10 @@ namespace Common { #else return _udiv128(r[1], r[0], d, &remainder); #endif +#else +#ifdef __SIZEOF_INT128__ + const auto product = static_cast(a) * static_cast(b); + return static_cast(product / d); #else const u64 diva = a / d; const u64 moda = a % d; @@ -37,6 +41,7 @@ namespace Common { 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; -- cgit v1.2.3