From 1dbe9d95e63b88f4156bed03552a1658da829516 Mon Sep 17 00:00:00 2001 From: MerryMage Date: Mon, 16 Jul 2018 15:07:26 +0100 Subject: [PATCH] FPRoundInt: Final FPRound based on new sign While this shouldn't change any of the results in theory, it's just logically more consistent --- src/common/fp/op/FPRoundInt.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/common/fp/op/FPRoundInt.cpp b/src/common/fp/op/FPRoundInt.cpp index c0a17f1f..5ecb34be 100644 --- a/src/common/fp/op/FPRoundInt.cpp +++ b/src/common/fp/op/FPRoundInt.cpp @@ -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(int_result) : static_cast(int_result); + const bool new_sign = Common::MostSignificantBit(int_result); + const u64 abs_int_result = new_sign ? Safe::Negate(int_result) : static_cast(int_result); const FPT result = int_result == 0 ? FPInfo::Zero(sign) - : FPRound(FPUnpacked{sign, 0, abs_int_result}, fpcr, RoundingMode::TowardsZero, fpsr); + : FPRound(FPUnpacked{new_sign, 0, abs_int_result}, fpcr, RoundingMode::TowardsZero, fpsr); if (error != ResidualError::Zero && exact) { FPProcessException(FPExc::Inexact, fpcr, fpsr);