1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-25 12:12:50 +01:00

Simplify utils::umulh64 (MSVC)

This commit is contained in:
Nekotekina 2021-04-29 00:10:38 +03:00
parent 703ec474f5
commit b1736b6411

View File

@ -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<u64>((u128{x} * u128{y}) >> 64);
}
#ifdef _MSC_VER
return __umulh(x, y);
#else
return (u128{x} * u128{y}) >> 64;
#endif
}