diff --git a/cpu/ppc/ppcopcodes.cpp b/cpu/ppc/ppcopcodes.cpp index 970b728..725fbb4 100644 --- a/cpu/ppc/ppcopcodes.cpp +++ b/cpu/ppc/ppcopcodes.cpp @@ -1261,10 +1261,11 @@ void dppc_interpreter::ppc_crandc() { } void dppc_interpreter::ppc_creqv() { ppc_grab_regsdab(); - if (!((ppc_state.cr & (0x80000000UL >> reg_a)) ^ (ppc_state.cr & (0x80000000UL >> reg_b)))) { - ppc_state.cr |= (0x80000000UL >> reg_d); - } else { + uint8_t ir = (ppc_state.cr >> (31 - reg_a)) ^ (ppc_state.cr >> (31 - reg_b)); + if (ir & 1) { // compliment is implemented by swapping the following if/else bodies ppc_state.cr &= ~(0x80000000UL >> reg_d); + } else { + ppc_state.cr |= (0x80000000UL >> reg_d); } } void dppc_interpreter::ppc_crnand() {