Interpreter: Fix NI_div ZX check

This commit is contained in:
JosJuice 2021-08-29 11:57:15 +02:00
parent 9f525d69c8
commit 25bff91054
1 changed files with 10 additions and 13 deletions

View File

@ -138,7 +138,15 @@ inline FPResult NI_div(UReg_FPSCR* fpscr, double a, double b)
{ {
FPResult result{a / b}; FPResult result{a / b};
if (std::isnan(result.value)) if (std::isinf(result.value))
{
if (b == 0.0)
{
result.SetException(fpscr, FPSCR_ZX);
return result;
}
}
else if (std::isnan(result.value))
{ {
if (Common::IsSNAN(a) || Common::IsSNAN(b)) if (Common::IsSNAN(a) || Common::IsSNAN(b))
result.SetException(fpscr, FPSCR_VXSNAN); result.SetException(fpscr, FPSCR_VXSNAN);
@ -157,20 +165,9 @@ inline FPResult NI_div(UReg_FPSCR* fpscr, double a, double b)
} }
if (b == 0.0) if (b == 0.0)
{
if (a == 0.0)
{
result.SetException(fpscr, FPSCR_VXZDZ); result.SetException(fpscr, FPSCR_VXZDZ);
}
else
{
result.SetException(fpscr, FPSCR_ZX);
}
}
else if (std::isinf(a) && std::isinf(b)) else if (std::isinf(a) && std::isinf(b))
{
result.SetException(fpscr, FPSCR_VXIDI); result.SetException(fpscr, FPSCR_VXIDI);
}
result.value = PPC_NAN; result.value = PPC_NAN;
return result; return result;