diff --git a/rpcs3/util/asm.hpp b/rpcs3/util/asm.hpp index e64939ab88..f59941dee9 100644 --- a/rpcs3/util/asm.hpp +++ b/rpcs3/util/asm.hpp @@ -410,10 +410,12 @@ namespace utils return static_cast(value * u64{numerator} / u64{denominator}); } +#if is_u128_emulated if constexpr (sizeof(T) <= sizeof(u128) / 2) { - return static_cast(value * u128{numerator} / u64{denominator}); + return static_cast(u128_from_mul(value, numerator) / u64{denominator}); } +#endif return static_cast(value / denominator * numerator + (value % denominator) * numerator / denominator); }