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:
parent
fefc7b526d
commit
88505bff06
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue