aboutsummaryrefslogtreecommitdiff
path: root/lopcodes.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lopcodes.h46
1 files changed, 23 insertions, 23 deletions
diff --git a/lopcodes.h b/lopcodes.h
index 7511eb22..97870038 100644
--- a/lopcodes.h
+++ b/lopcodes.h
@@ -126,14 +126,14 @@ enum OpMode {iABC, ivABC, iABx, iAsBx, iAx, isJ};
126 126
127#define GET_OPCODE(i) (cast(OpCode, ((i)>>POS_OP) & MASK1(SIZE_OP,0))) 127#define GET_OPCODE(i) (cast(OpCode, ((i)>>POS_OP) & MASK1(SIZE_OP,0)))
128#define SET_OPCODE(i,o) ((i) = (((i)&MASK0(SIZE_OP,POS_OP)) | \ 128#define SET_OPCODE(i,o) ((i) = (((i)&MASK0(SIZE_OP,POS_OP)) | \
129 ((cast(Instruction, o)<<POS_OP)&MASK1(SIZE_OP,POS_OP)))) 129 ((cast_Inst(o)<<POS_OP)&MASK1(SIZE_OP,POS_OP))))
130 130
131#define checkopm(i,m) (getOpMode(GET_OPCODE(i)) == m) 131#define checkopm(i,m) (getOpMode(GET_OPCODE(i)) == m)
132 132
133 133
134#define getarg(i,pos,size) (cast_int(((i)>>(pos)) & MASK1(size,0))) 134#define getarg(i,pos,size) (cast_int(((i)>>(pos)) & MASK1(size,0)))
135#define setarg(i,v,pos,size) ((i) = (((i)&MASK0(size,pos)) | \ 135#define setarg(i,v,pos,size) ((i) = (((i)&MASK0(size,pos)) | \
136 ((cast(Instruction, v)<<pos)&MASK1(size,pos)))) 136 ((cast_Inst(v)<<pos)&MASK1(size,pos))))
137 137
138#define GETARG_A(i) getarg(i, POS_A, SIZE_A) 138#define GETARG_A(i) getarg(i, POS_A, SIZE_A)
139#define SETARG_A(i,v) setarg(i, v, POS_A, SIZE_A) 139#define SETARG_A(i,v) setarg(i, v, POS_A, SIZE_A)
@@ -174,28 +174,28 @@ enum OpMode {iABC, ivABC, iABx, iAsBx, iAx, isJ};
174 setarg(i, cast_uint((j)+OFFSET_sJ), POS_sJ, SIZE_sJ) 174 setarg(i, cast_uint((j)+OFFSET_sJ), POS_sJ, SIZE_sJ)
175 175
176 176
177#define CREATE_ABCk(o,a,b,c,k) ((cast(Instruction, o)<<POS_OP) \ 177#define CREATE_ABCk(o,a,b,c,k) ((cast_Inst(o)<<POS_OP) \
178 | (cast(Instruction, a)<<POS_A) \ 178 | (cast_Inst(a)<<POS_A) \
179 | (cast(Instruction, b)<<POS_B) \ 179 | (cast_Inst(b)<<POS_B) \
180 | (cast(Instruction, c)<<POS_C) \ 180 | (cast_Inst(c)<<POS_C) \
181 | (cast(Instruction, k)<<POS_k)) 181 | (cast_Inst(k)<<POS_k))
182 182
183#define CREATE_vABCk(o,a,b,c,k) ((cast(Instruction, o)<<POS_OP) \ 183#define CREATE_vABCk(o,a,b,c,k) ((cast_Inst(o)<<POS_OP) \
184 | (cast(Instruction, a)<<POS_A) \ 184 | (cast_Inst(a)<<POS_A) \
185 | (cast(Instruction, b)<<POS_vB) \ 185 | (cast_Inst(b)<<POS_vB) \
186 | (cast(Instruction, c)<<POS_vC) \ 186 | (cast_Inst(c)<<POS_vC) \
187 | (cast(Instruction, k)<<POS_k)) 187 | (cast_Inst(k)<<POS_k))
188 188
189#define CREATE_ABx(o,a,bc) ((cast(Instruction, o)<<POS_OP) \ 189#define CREATE_ABx(o,a,bc) ((cast_Inst(o)<<POS_OP) \
190 | (cast(Instruction, a)<<POS_A) \ 190 | (cast_Inst(a)<<POS_A) \
191 | (cast(Instruction, bc)<<POS_Bx)) 191 | (cast_Inst(bc)<<POS_Bx))
192 192
193#define CREATE_Ax(o,a) ((cast(Instruction, o)<<POS_OP) \ 193#define CREATE_Ax(o,a) ((cast_Inst(o)<<POS_OP) \
194 | (cast(Instruction, a)<<POS_Ax)) 194 | (cast_Inst(a)<<POS_Ax))
195 195
196#define CREATE_sJ(o,j,k) ((cast(Instruction, o) << POS_OP) \ 196#define CREATE_sJ(o,j,k) ((cast_Inst(o) << POS_OP) \
197 | (cast(Instruction, j) << POS_sJ) \ 197 | (cast_Inst(j) << POS_sJ) \
198 | (cast(Instruction, k) << POS_k)) 198 | (cast_Inst(k) << POS_k))
199 199
200 200
201#if !defined(MAXINDEXRK) /* (for debugging only) */ 201#if !defined(MAXINDEXRK) /* (for debugging only) */
@@ -254,7 +254,7 @@ OP_SETTABLE,/* A B C R[A][R[B]] := RK(C) */
254OP_SETI,/* A B C R[A][B] := RK(C) */ 254OP_SETI,/* A B C R[A][B] := RK(C) */
255OP_SETFIELD,/* A B C R[A][K[B]:shortstring] := RK(C) */ 255OP_SETFIELD,/* A B C R[A][K[B]:shortstring] := RK(C) */
256 256
257OP_NEWTABLE,/* A B C k R[A] := {} */ 257OP_NEWTABLE,/* A vB vC k R[A] := {} */
258 258
259OP_SELF,/* A B C R[A+1] := R[B]; R[A] := R[B][K[C]:shortstring] */ 259OP_SELF,/* A B C R[A+1] := R[B]; R[A] := R[B][K[C]:shortstring] */
260 260
@@ -378,9 +378,9 @@ OP_EXTRAARG/* Ax extra (larger) argument for previous opcode */
378 real C = EXTRAARG _ C (the bits of EXTRAARG concatenated with the 378 real C = EXTRAARG _ C (the bits of EXTRAARG concatenated with the
379 bits of C). 379 bits of C).
380 380
381 (*) In OP_NEWTABLE, B is log2 of the hash size (which is always a 381 (*) In OP_NEWTABLE, vB is log2 of the hash size (which is always a
382 power of 2) plus 1, or zero for size zero. If not k, the array size 382 power of 2) plus 1, or zero for size zero. If not k, the array size
383 is C. Otherwise, the array size is EXTRAARG _ C. 383 is vC. Otherwise, the array size is EXTRAARG _ vC.
384 384
385 (*) For comparisons, k specifies what condition the test should accept 385 (*) For comparisons, k specifies what condition the test should accept
386 (true or false). 386 (true or false).