ref: c1558eaf7960ef9e6e516c4696cf28cc53bd99af
parent: a1ec2a718e05beae06a888a5db66bbc9b6cd19ca
author: cinap_lenrek <cinap_lenrek@centraldogma>
date: Thu Apr 28 23:56:20 EDT 2011
realemu: bittest memory operands
--- a/sys/src/cmd/aux/realemu/xec.c
+++ b/sys/src/cmd/aux/realemu/xec.c
@@ -485,7 +485,7 @@
}
static void
-opbt(Cpu *cpu, Inst *i)
+opbittest(Cpu *cpu, Inst *i)
{ulong a, m;
int n, s;
@@ -495,9 +495,12 @@
x = i->a1;
s = x->len*8;
if(x->tag == TMEM){+ int z;
+
x = adup(x);
- x->off += n / s;
- x->off &= mask(i->alen*8);
+ x->off += (n / s) * x->len;
+ z = i->alen*8;
+ x->off &= mask(z);
}
a = ar(x);
n &= s-1;
@@ -1208,10 +1211,10 @@
[OROL] = oprol,
[OROR] = opror,
- [OBT] = opbt,
- [OBTS] = opbt,
- [OBTR] = opbt,
- [OBTC] = opbt,
+ [OBT] = opbittest,
+ [OBTS] = opbittest,
+ [OBTR] = opbittest,
+ [OBTC] = opbittest,
[OBSF] = opbitscan,
[OBSR] = opbitscan,
--
⑨