poweropcodes: Fix abs.

Making a negative value positive requires unary negate operator rather than binary and operator since negative numbers are stored using twos compliment.
If ov is set then clear overflow when overflow doesn't happen.
This commit is contained in:
joevt 2024-04-09 01:07:48 -07:00 committed by dingusdev
parent cb88bab67d
commit 529f23d836

View File

@ -52,9 +52,10 @@ void dppc_interpreter::power_abs() {
ppc_result_d = ppc_result_a;
if (ov)
ppc_state.spr[SPR::XER] |= XER::SO | XER::OV;
} else {
ppc_result_d = ppc_result_a & 0x7FFFFFFF;
ppc_result_d = (int32_t(ppc_result_a) < 0) ? -ppc_result_a : ppc_result_a;
if (ov)
ppc_state.spr[SPR::XER] &= ~XER::OV;
}
if (rec)