mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-10 00:41:26 +12:00
Simplify utils::umulh64 (MSVC)
This commit is contained in:
parent
703ec474f5
commit
b1736b6411
1 changed files with 3 additions and 10 deletions
|
@ -249,20 +249,13 @@ namespace utils
|
||||||
{
|
{
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
if (std::is_constant_evaluated())
|
if (std::is_constant_evaluated())
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
u128 a = (u32)x * (u64)(u32)y;
|
return static_cast<u64>((u128{x} * u128{y}) >> 64);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
return __umulh(x, y);
|
return __umulh(x, y);
|
||||||
#else
|
|
||||||
return (u128{x} * u128{y}) >> 64;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue