summaryrefslogtreecommitdiff
path: root/sys/src/cmd/aux/realemu
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2014-02-03 22:55:45 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2014-02-03 22:55:45 +0100
commit88505bff06822e2d6313de477874a7a816935ea7 (patch)
tree5aa2575b1187748d10a88a24c5787285757140a9 /sys/src/cmd/aux/realemu
parentfefc7b526da85c55d3cad66bfe8b565ac40f78d1 (diff)
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).
Diffstat (limited to 'sys/src/cmd/aux/realemu')
-rw-r--r--sys/src/cmd/aux/realemu/xec.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/sys/src/cmd/aux/realemu/xec.c b/sys/src/cmd/aux/realemu/xec.c
index 90c8bc1ec..4195abe73 100644
--- a/sys/src/cmd/aux/realemu/xec.c
+++ b/sys/src/cmd/aux/realemu/xec.c
@@ -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);