mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-22 02:32:36 +01:00
Simplify utils::umulh64 (MSVC)
This commit is contained in:
parent
703ec474f5
commit
b1736b6411
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user