working on the Xbox 360 port i came across the disabled optimize pragma in DSP.cpp.
In DSP.cpp
Line 1196:
Code: Select all
//case 6: and case 7: immediate format
OperandPool[Operands]=operand.iof.IMMEDIATE<<(operand.iof.JUSTIFY&3);
change that to
Code: Select all
//case 6: and case 7: immediate format
OperandPool[Operands]=operand.iof.IMMEDIATE<<(~((operand.iof.JUSTIFY)+1)&3);
and Line 1299:
Code: Select all
//case 6: and case 7: immediate format
Operand=operand.iof.IMMEDIATE<<(operand.iof.JUSTIFY&3);
change that to
Code: Select all
//case 6: and case 7: immediate format
Operand=operand.iof.IMMEDIATE<<(~((operand.iof.JUSTIFY)+1)&3);
You can now remove the #pragma optimize block around this code It will give you a nice performance boost as well
The reason why an optimized build breaks on this code is because operand.iof.JUSTIFY is a signed integer and bit shifting on a signed value can cause undetermined results. What the fix does is perform twos complement representation of the signed integer.