From b1736b641120b768d48af159a8bb309304c2184a Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Thu, 29 Apr 2021 00:10:38 +0300 Subject: [PATCH] Simplify utils::umulh64 (MSVC) --- rpcs3/util/asm.hpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/rpcs3/util/asm.hpp b/rpcs3/util/asm.hpp index 77244dab84..5757e06233 100644 --- a/rpcs3/util/asm.hpp +++ b/rpcs3/util/asm.hpp @@ -249,20 +249,13 @@ namespace utils { #ifdef _MSC_VER if (std::is_constant_evaluated()) +#endif { - u128 a = (u32)x * (u64)(u32)y; - u128 b = (x >> 32) * (u32)y; - u128 c = (u32)x * (y >> 32); - u128 d = (x >> 32) * (y >> 32); - a += (b << 32); - a += (c << 32); - a.hi += d.lo; - return a.hi; + return static_cast((u128{x} * u128{y}) >> 64); } +#ifdef _MSC_VER return __umulh(x, y); -#else - return (u128{x} * u128{y}) >> 64; #endif }