aboutsummaryrefslogtreecommitdiff
path: root/lopcodes.h
diff options
context:
space:
mode:
Diffstat (limited to 'lopcodes.h')
-rw-r--r--lopcodes.h42
1 files changed, 21 insertions, 21 deletions
diff --git a/lopcodes.h b/lopcodes.h
index 1fba78f3..f581dd1d 100644
--- a/lopcodes.h
+++ b/lopcodes.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lopcodes.h,v 1.78 2001/07/24 17:19:07 roberto Exp roberto $ 2** $Id: lopcodes.h,v 1.79 2001/08/27 15:14:57 roberto Exp $
3** Opcodes for Lua virtual machine 3** Opcodes for Lua virtual machine
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -76,37 +76,37 @@ enum OpMode {iABC, iABc, iAsBc}; /* basic instruction format */
76** the following macros help to manipulate instructions 76** the following macros help to manipulate instructions
77*/ 77*/
78 78
79#define GET_OPCODE(i) ((OpCode)((i)&MASK1(SIZE_OP,0))) 79#define GET_OPCODE(i) (cast(OpCode, (i)&MASK1(SIZE_OP,0)))
80#define SET_OPCODE(i,o) (((i)&MASK0(SIZE_OP,0)) | (Instruction)(o)) 80#define SET_OPCODE(i,o) (((i)&MASK0(SIZE_OP,0)) | cast(Instruction, o))
81 81
82#define GETARG_A(i) ((int)((i)>>POS_A)) 82#define GETARG_A(i) (cast(int, (i)>>POS_A))
83#define SETARG_A(i,u) ((i) = (((i)&MASK0(SIZE_A,POS_A)) | \ 83#define SETARG_A(i,u) ((i) = (((i)&MASK0(SIZE_A,POS_A)) | \
84 ((Instruction)(u)<<POS_A))) 84 (cast(Instruction, u)<<POS_A)))
85 85
86#define GETARG_B(i) ((int)(((i)>>POS_B) & MASK1(SIZE_B,0))) 86#define GETARG_B(i) (cast(int, ((i)>>POS_B) & MASK1(SIZE_B,0)))
87#define SETARG_B(i,b) ((i) = (((i)&MASK0(SIZE_B,POS_B)) | \ 87#define SETARG_B(i,b) ((i) = (((i)&MASK0(SIZE_B,POS_B)) | \
88 ((Instruction)(b)<<POS_B))) 88 (cast(Instruction, b)<<POS_B)))
89 89
90#define GETARG_C(i) ((int)(((i)>>POS_C) & MASK1(SIZE_C,0))) 90#define GETARG_C(i) (cast(int, ((i)>>POS_C) & MASK1(SIZE_C,0)))
91#define SETARG_C(i,b) ((i) = (((i)&MASK0(SIZE_C,POS_C)) | \ 91#define SETARG_C(i,b) ((i) = (((i)&MASK0(SIZE_C,POS_C)) | \
92 ((Instruction)(b)<<POS_C))) 92 (cast(Instruction, b)<<POS_C)))
93 93
94#define GETARG_Bc(i) ((int)(((i)>>POS_Bc) & MASK1(SIZE_Bc,0))) 94#define GETARG_Bc(i) (cast(int, ((i)>>POS_Bc) & MASK1(SIZE_Bc,0)))
95#define SETARG_Bc(i,b) ((i) = (((i)&MASK0(SIZE_Bc,POS_Bc)) | \ 95#define SETARG_Bc(i,b) ((i) = (((i)&MASK0(SIZE_Bc,POS_Bc)) | \
96 ((Instruction)(b)<<POS_Bc))) 96 (cast(Instruction, b)<<POS_Bc)))
97 97
98#define GETARG_sBc(i) (GETARG_Bc(i)-MAXARG_sBc) 98#define GETARG_sBc(i) (GETARG_Bc(i)-MAXARG_sBc)
99#define SETARG_sBc(i,b) SETARG_Bc((i),(unsigned int)((b)+MAXARG_sBc)) 99#define SETARG_sBc(i,b) SETARG_Bc((i),cast(unsigned int, (b)+MAXARG_sBc))
100 100
101 101
102#define CREATE_ABC(o,a,b,c) ((Instruction)(o) \ 102#define CREATE_ABC(o,a,b,c) (cast(Instruction, o) \
103 | ((Instruction)(a)<<POS_A) \ 103 | (cast(Instruction, a)<<POS_A) \
104 | ((Instruction)(b)<<POS_B) \ 104 | (cast(Instruction, b)<<POS_B) \
105 | ((Instruction)(c)<<POS_C)) 105 | (cast(Instruction, c)<<POS_C))
106 106
107#define CREATE_ABc(o,a,bc) ((Instruction)(o) \ 107#define CREATE_ABc(o,a,bc) (cast(Instruction, o) \
108 | ((Instruction)(a)<<POS_A) \ 108 | (cast(Instruction, a)<<POS_A) \
109 | ((Instruction)(bc)<<POS_Bc)) 109 | (cast(Instruction, bc)<<POS_Bc))
110 110
111 111
112 112
@@ -184,7 +184,7 @@ OP_CLOSURE /* A Bc R(A) := closure(KPROTO[Bc], R(A), ... ,R(A+n)) */
184} OpCode; 184} OpCode;
185 185
186 186
187#define NUM_OPCODES ((int)OP_CLOSURE+1) 187#define NUM_OPCODES (cast(int, OP_CLOSURE+1))
188 188
189 189
190 190
@@ -215,7 +215,7 @@ enum OpModeMask {
215 215
216extern const lu_byte luaP_opmodes[NUM_OPCODES]; 216extern const lu_byte luaP_opmodes[NUM_OPCODES];
217 217
218#define getOpMode(m) ((enum OpMode)(luaP_opmodes[m] & 3)) 218#define getOpMode(m) (cast(enum OpMode, luaP_opmodes[m] & 3))
219#define testOpMode(m, b) (luaP_opmodes[m] & (1 << (b))) 219#define testOpMode(m, b) (luaP_opmodes[m] & (1 << (b)))
220 220
221 221