DSPInterpreter: Sign-extend acS.h to 32 bits
Thus, the 40-bit accumulator is treated as properly sign-extended when read as a 64-bit number. This affects e.g. overflow detection.
This commit is contained in:
parent
105d8860fb
commit
74440c468f
|
@ -271,7 +271,7 @@ struct DSP_Regs
|
|||
{
|
||||
u16 l;
|
||||
u16 m;
|
||||
u16 h;
|
||||
u32 h; // 32 bits so that val is fully sign-extended (only 8 bits are actually used)
|
||||
};
|
||||
} ac[2];
|
||||
};
|
||||
|
|
|
@ -769,7 +769,7 @@ void Interpreter::ConditionalExtendAccum(int reg)
|
|||
// Sign extend into whole accum.
|
||||
auto& state = m_dsp_core.DSPState();
|
||||
const u16 val = state.r.ac[reg - DSP_REG_ACM0].m;
|
||||
state.r.ac[reg - DSP_REG_ACM0].h = (val & 0x8000) != 0 ? 0xFFFF : 0x0000;
|
||||
state.r.ac[reg - DSP_REG_ACM0].h = (val & 0x8000) != 0 ? 0xFFFFFFFF : 0x0000;
|
||||
state.r.ac[reg - DSP_REG_ACM0].l = 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue