mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-11-05 11:07:28 +00:00
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:
parent
cb88bab67d
commit
529f23d836
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user