mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-22 04:25:19 +00:00
asm.hpp: Fix mul_saturate
This commit is contained in:
parent
441fbd63bb
commit
307e1351df
1 changed files with 1 additions and 2 deletions
|
@ -401,11 +401,10 @@ namespace utils
|
|||
return minuend < subtrahend ? T{0} : static_cast<T>(minuend - subtrahend);
|
||||
}
|
||||
|
||||
|
||||
template <UnsignedInt T>
|
||||
constexpr T mul_saturate(T factor1, T factor2)
|
||||
{
|
||||
return T{umax} / factor1 < factor2 ? T{umax} : static_cast<T>(factor1 * factor2);
|
||||
return factor1 > 0 && T{umax} / factor1 < factor2 ? T{umax} : static_cast<T>(factor1 * factor2);
|
||||
}
|
||||
|
||||
// Hack. Pointer cast util to workaround UB. Use with extreme care.
|
||||
|
|
Loading…
Add table
Reference in a new issue