1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

asm: Fix utils::rational_mul optimization

This commit is contained in:
elad335 2024-10-24 10:12:50 +03:00 committed by Elad
parent 3378b03c1f
commit a9a454faf7

View File

@ -410,10 +410,12 @@ namespace utils
return static_cast<T>(value * u64{numerator} / u64{denominator});
}
#if is_u128_emulated
if constexpr (sizeof(T) <= sizeof(u128) / 2)
{
return static_cast<T>(value * u128{numerator} / u64{denominator});
return static_cast<T>(u128_from_mul(value, numerator) / u64{denominator});
}
#endif
return static_cast<T>(value / denominator * numerator + (value % denominator) * numerator / denominator);
}