ppcopcodes: fix crand emulation.

This commit is contained in:
Maxim Poliakovski 2022-01-21 14:56:10 +01:00
parent c864b9b7d9
commit 2442bd17b3

View File

@ -1243,7 +1243,8 @@ void dppc_interpreter::ppc_mcrf() {
void dppc_interpreter::ppc_crand() {
ppc_grab_regsdab();
if ((ppc_state.cr & (0x80000000UL >> reg_a)) && (ppc_state.cr & (0x80000000UL >> reg_b))) {
uint8_t ir = (ppc_state.cr >> (31 - reg_a)) & (ppc_state.cr >> (31 - reg_b));
if (ir & 1) {
ppc_state.cr |= (0x80000000UL >> reg_d);
} else {
ppc_state.cr &= ~(0x80000000UL >> reg_d);