mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-12 23:48:58 +01:00
Interpreter: Rearrange ordered/unordered compares
Comparing floating point numbers with == can trigger warnings (and have static analysis tools complain). So we make it the else case. This also more closely resembles the Gekko manual.
This commit is contained in:
parent
860c889454
commit
09319a1e11
@ -22,19 +22,7 @@ void Interpreter::Helper_FloatCompareOrdered(UGeckoInstruction _inst, double fa,
|
||||
{
|
||||
int compareResult;
|
||||
|
||||
if (fa < fb)
|
||||
{
|
||||
compareResult = FPCC::FL;
|
||||
}
|
||||
else if (fa > fb)
|
||||
{
|
||||
compareResult = FPCC::FG;
|
||||
}
|
||||
else if (fa == fb)
|
||||
{
|
||||
compareResult = FPCC::FE;
|
||||
}
|
||||
else // NaN
|
||||
if (IsNAN(fa) || IsNAN(fb))
|
||||
{
|
||||
FPSCR.FX = 1;
|
||||
compareResult = FPCC::FU;
|
||||
@ -51,6 +39,18 @@ void Interpreter::Helper_FloatCompareOrdered(UGeckoInstruction _inst, double fa,
|
||||
SetFPException(FPSCR_VXVC);
|
||||
}
|
||||
}
|
||||
else if (fa < fb)
|
||||
{
|
||||
compareResult = FPCC::FL;
|
||||
}
|
||||
else if (fa > fb)
|
||||
{
|
||||
compareResult = FPCC::FG;
|
||||
}
|
||||
else // Equals
|
||||
{
|
||||
compareResult = FPCC::FE;
|
||||
}
|
||||
|
||||
FPSCR.FPRF = compareResult;
|
||||
SetCRField(_inst.CRFD, compareResult);
|
||||
@ -60,7 +60,17 @@ void Interpreter::Helper_FloatCompareUnordered(UGeckoInstruction _inst, double f
|
||||
{
|
||||
int compareResult;
|
||||
|
||||
if (fa < fb)
|
||||
if (IsNAN(fa) || IsNAN(fb))
|
||||
{
|
||||
compareResult = FPCC::FU;
|
||||
|
||||
if (IsSNAN(fa) || IsSNAN(fb))
|
||||
{
|
||||
FPSCR.FX = 1;
|
||||
SetFPException(FPSCR_VXSNAN);
|
||||
}
|
||||
}
|
||||
else if (fa < fb)
|
||||
{
|
||||
compareResult = FPCC::FL;
|
||||
}
|
||||
@ -68,19 +78,10 @@ void Interpreter::Helper_FloatCompareUnordered(UGeckoInstruction _inst, double f
|
||||
{
|
||||
compareResult = FPCC::FG;
|
||||
}
|
||||
else if (fa == fb)
|
||||
else // Equals
|
||||
{
|
||||
compareResult = FPCC::FE;
|
||||
}
|
||||
else
|
||||
{
|
||||
compareResult = FPCC::FU;
|
||||
if (IsSNAN(fa) || IsSNAN(fb))
|
||||
{
|
||||
FPSCR.FX = 1;
|
||||
SetFPException(FPSCR_VXSNAN);
|
||||
}
|
||||
}
|
||||
|
||||
FPSCR.FPRF = compareResult;
|
||||
SetCRField(_inst.CRFD, compareResult);
|
||||
|
Loading…
x
Reference in New Issue
Block a user