FPRoundInt: Final FPRound based on new sign

While this shouldn't change any of the results in theory, it's just logically more consistent
This commit is contained in:
MerryMage 2018-07-16 15:07:26 +01:00
parent 83be491875
commit 1dbe9d95e6

View file

@ -72,11 +72,12 @@ u64 FPRoundInt(FPT op, FPCR fpcr, RoundingMode rounding, bool exact, FPSR& fpsr)
int_result++;
}
const u64 abs_int_result = Common::MostSignificantBit(int_result) ? Safe::Negate<u64>(int_result) : static_cast<u64>(int_result);
const bool new_sign = Common::MostSignificantBit(int_result);
const u64 abs_int_result = new_sign ? Safe::Negate<u64>(int_result) : static_cast<u64>(int_result);
const FPT result = int_result == 0
? FPInfo<FPT>::Zero(sign)
: FPRound<FPT>(FPUnpacked<u64>{sign, 0, abs_int_result}, fpcr, RoundingMode::TowardsZero, fpsr);
: FPRound<FPT>(FPUnpacked<u64>{new_sign, 0, abs_int_result}, fpcr, RoundingMode::TowardsZero, fpsr);
if (error != ResidualError::Zero && exact) {
FPProcessException(FPExc::Inexact, fpcr, fpsr);