MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / _add32_Overflow

Function _add32_Overflow

pcsx2/R5900OpcodeImpl.cpp:44–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44static __fi bool _add32_Overflow( s32 x, s32 y, s64 &ret )
45{
46 GPR_reg64 result; result.SD[0] = (s64)x + y;
47
48 // This 32bit method can rely on the MIPS documented method of checking for
49 // overflow, whichs imply compares bit 32 (rightmost bit of the upper word),
50 // against bit 31 (leftmost of the lower word).
51
52 // If bit32 != bit31 then we have an overflow.
53 if( (result.UL[0]>>31) != (result.UL[1] & 1) ) {
54 cpuException(0x30, cpuRegs.branch);
55 return true;
56 }
57
58 ret = result.SD[0];
59
60 return false;
61}
62
63
64const R5900::OPCODE& R5900::GetCurrentInstruction()

Callers 3

ADDIFunction · 0.85
ADDFunction · 0.85
SUBFunction · 0.85

Calls 1

cpuExceptionFunction · 0.85

Tested by

no test coverage detected