realemu: cleanup opidiv

no need for switch here, just calculate the values. also fixes
6l warning about uninitialized min/max (compiler assumes none
of the case statements could match).
This commit is contained in:
cinap_lenrek 2014-02-03 22:55:45 +01:00
parent fefc7b526d
commit 88505bff06

View file

@ -799,21 +799,8 @@ opidiv(Cpu *cpu, Inst *i)
q = n/d;
r = n%d;
/* check for overflow based on operand size */
switch(s) {
case 8:
min = (char)0x80;
max = 0x7F;
break;
case 16:
min = (short)0x8000;
max = 0x7FFF;
break;
case 32:
min = (long)0x80000000;
max = 0x7FFFFFFF;
break;
}
max = sign(s)-1;
min = ~max;
if(q > max || q < min)
trap(cpu, EDIV0);