aboutsummaryrefslogtreecommitdiff
path: root/lopcodes.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-01-28 13:13:26 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-01-28 13:13:26 -0200
commite2b15aa21d2f31ccc93e35f50928e26a8d9c84ce (patch)
tree0c8fe009fffa187be71ea3e268daf1a6e29d6d9a /lopcodes.h
parent89110986d7a9e81960261ae682780d5fd06dc4ac (diff)
downloadlua-e2b15aa21d2f31ccc93e35f50928e26a8d9c84ce.tar.gz
lua-e2b15aa21d2f31ccc93e35f50928e26a8d9c84ce.tar.bz2
lua-e2b15aa21d2f31ccc93e35f50928e26a8d9c84ce.zip
janitor work on casts
Diffstat (limited to 'lopcodes.h')
-rw-r--r--lopcodes.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/lopcodes.h b/lopcodes.h
index 2f4a48fa..1e3974d9 100644
--- a/lopcodes.h
+++ b/lopcodes.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lopcodes.h,v 1.182 2018/01/09 11:24:12 roberto Exp roberto $ 2** $Id: lopcodes.h,v 1.183 2018/01/27 16:56:33 roberto Exp roberto $
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*/
@@ -111,7 +111,7 @@ enum OpMode {iABC, iABx, iAsBx, iAx, isJ}; /* basic instruction formats */
111#define checkopm(i,m) (getOpMode(GET_OPCODE(i)) == m) 111#define checkopm(i,m) (getOpMode(GET_OPCODE(i)) == m)
112 112
113 113
114#define getarg(i,pos,size) (cast(int, ((i)>>(pos)) & MASK1(size,0))) 114#define getarg(i,pos,size) (cast_int(((i)>>(pos)) & MASK1(size,0)))
115#define setarg(i,v,pos,size) ((i) = (((i)&MASK0(size,pos)) | \ 115#define setarg(i,v,pos,size) ((i) = (((i)&MASK0(size,pos)) | \
116 ((cast(Instruction, v)<<pos)&MASK1(size,pos)))) 116 ((cast(Instruction, v)<<pos)&MASK1(size,pos))))
117 117
@@ -126,7 +126,7 @@ enum OpMode {iABC, iABx, iAsBx, iAx, isJ}; /* basic instruction formats */
126#define GETARG_sC(i) (GETARG_C(i) - OFFSET_sC) 126#define GETARG_sC(i) (GETARG_C(i) - OFFSET_sC)
127#define SETARG_C(i,v) setarg(i, v, POS_C, SIZE_C) 127#define SETARG_C(i,v) setarg(i, v, POS_C, SIZE_C)
128 128
129#define TESTARG_k(i) (cast(int, ((i) & (1u << POS_k)))) 129#define TESTARG_k(i) (cast_int(((i) & (1u << POS_k))))
130#define GETARG_k(i) check_exp(checkopm(i, iABC), getarg(i, POS_k, 1)) 130#define GETARG_k(i) check_exp(checkopm(i, iABC), getarg(i, POS_k, 1))
131#define SETARG_k(i,v) setarg(i, v, POS_k, 1) 131#define SETARG_k(i,v) setarg(i, v, POS_k, 1)
132 132
@@ -138,12 +138,12 @@ enum OpMode {iABC, iABx, iAsBx, iAx, isJ}; /* basic instruction formats */
138 138
139#define GETARG_sBx(i) \ 139#define GETARG_sBx(i) \
140 check_exp(checkopm(i, iAsBx), getarg(i, POS_Bx, SIZE_Bx) - OFFSET_sBx) 140 check_exp(checkopm(i, iAsBx), getarg(i, POS_Bx, SIZE_Bx) - OFFSET_sBx)
141#define SETARG_sBx(i,b) SETARG_Bx((i),cast(unsigned int, (b)+OFFSET_sBx)) 141#define SETARG_sBx(i,b) SETARG_Bx((i),cast_uint((b)+OFFSET_sBx))
142 142
143#define GETARG_sJ(i) \ 143#define GETARG_sJ(i) \
144 check_exp(checkopm(i, isJ), getarg(i, POS_sJ, SIZE_sJ) - OFFSET_sJ) 144 check_exp(checkopm(i, isJ), getarg(i, POS_sJ, SIZE_sJ) - OFFSET_sJ)
145#define SETARG_sJ(i,j) \ 145#define SETARG_sJ(i,j) \
146 setarg(i, cast(unsigned int, (j)+OFFSET_sJ), POS_sJ, SIZE_sJ) 146 setarg(i, cast_uint((j)+OFFSET_sJ), POS_sJ, SIZE_sJ)
147#define GETARG_m(i) check_exp(checkopm(i, isJ), getarg(i, POS_m, 1)) 147#define GETARG_m(i) check_exp(checkopm(i, isJ), getarg(i, POS_m, 1))
148#define SETARG_m(i,m) setarg(i, m, POS_m, 1) 148#define SETARG_m(i,m) setarg(i, m, POS_m, 1)
149 149
@@ -292,7 +292,7 @@ OP_EXTRAARG/* Ax extra (larger) argument for previous opcode */
292} OpCode; 292} OpCode;
293 293
294 294
295#define NUM_OPCODES (cast(int, OP_EXTRAARG) + 1) 295#define NUM_OPCODES (cast_int(OP_EXTRAARG) + 1)
296 296
297 297
298 298