mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-01-20 15:25:38 +00:00
CPU/PGXP: Fix incorrect Y on invalid add/sub
This commit is contained in:
parent
5881133cf5
commit
e5c62b8baf
|
@ -972,7 +972,7 @@ void CPU::PGXP::CPU_ADD(u32 instr, u32 rsVal, u32 rtVal)
|
||||||
float of = (ret.x > USHRT_MAX) ? 1.f : (ret.x < 0) ? -1.f : 0.f;
|
float of = (ret.x > USHRT_MAX) ? 1.f : (ret.x < 0) ? -1.f : 0.f;
|
||||||
ret.x = (float)f16Sign(ret.x);
|
ret.x = (float)f16Sign(ret.x);
|
||||||
// ret.x -= of * (USHRT_MAX + 1);
|
// ret.x -= of * (USHRT_MAX + 1);
|
||||||
ret.y += prtVal.GetValidY(rtVal) + of;
|
ret.y = prsVal.GetValidY(rsVal) + prtVal.GetValidY(rtVal) + of;
|
||||||
|
|
||||||
// truncate on overflow/underflow
|
// truncate on overflow/underflow
|
||||||
ret.y += (ret.y > SHRT_MAX) ? -(USHRT_MAX + 1) : (ret.y < SHRT_MIN) ? USHRT_MAX + 1 : 0.f;
|
ret.y += (ret.y > SHRT_MAX) ? -(USHRT_MAX + 1) : (ret.y < SHRT_MIN) ? USHRT_MAX + 1 : 0.f;
|
||||||
|
@ -1016,7 +1016,7 @@ void CPU::PGXP::CPU_SUB(u32 instr, u32 rsVal, u32 rtVal)
|
||||||
float of = (ret.x > USHRT_MAX) ? 1.f : (ret.x < 0) ? -1.f : 0.f;
|
float of = (ret.x > USHRT_MAX) ? 1.f : (ret.x < 0) ? -1.f : 0.f;
|
||||||
ret.x = (float)f16Sign(ret.x);
|
ret.x = (float)f16Sign(ret.x);
|
||||||
// ret.x -= of * (USHRT_MAX + 1);
|
// ret.x -= of * (USHRT_MAX + 1);
|
||||||
ret.y -= prtVal.GetValidY(rtVal) - of;
|
ret.y = prsVal.GetValidY(rsVal) - (prtVal.GetValidY(rtVal) - of);
|
||||||
|
|
||||||
// truncate on overflow/underflow
|
// truncate on overflow/underflow
|
||||||
ret.y += (ret.y > SHRT_MAX) ? -(USHRT_MAX + 1) : (ret.y < SHRT_MIN) ? USHRT_MAX + 1 : 0.f;
|
ret.y += (ret.y > SHRT_MAX) ? -(USHRT_MAX + 1) : (ret.y < SHRT_MIN) ? USHRT_MAX + 1 : 0.f;
|
||||||
|
|
Loading…
Reference in a new issue