From e1d072571ec6f9d830e575a2ecdc95fd43428e53 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 31 Aug 2001 16:46:07 -0300 Subject: better syntax for type casts --- lopcodes.h | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'lopcodes.h') diff --git a/lopcodes.h b/lopcodes.h index 1fba78f3..f581dd1d 100644 --- a/lopcodes.h +++ b/lopcodes.h @@ -1,5 +1,5 @@ /* -** $Id: lopcodes.h,v 1.78 2001/07/24 17:19:07 roberto Exp roberto $ +** $Id: lopcodes.h,v 1.79 2001/08/27 15:14:57 roberto Exp $ ** Opcodes for Lua virtual machine ** See Copyright Notice in lua.h */ @@ -76,37 +76,37 @@ enum OpMode {iABC, iABc, iAsBc}; /* basic instruction format */ ** the following macros help to manipulate instructions */ -#define GET_OPCODE(i) ((OpCode)((i)&MASK1(SIZE_OP,0))) -#define SET_OPCODE(i,o) (((i)&MASK0(SIZE_OP,0)) | (Instruction)(o)) +#define GET_OPCODE(i) (cast(OpCode, (i)&MASK1(SIZE_OP,0))) +#define SET_OPCODE(i,o) (((i)&MASK0(SIZE_OP,0)) | cast(Instruction, o)) -#define GETARG_A(i) ((int)((i)>>POS_A)) +#define GETARG_A(i) (cast(int, (i)>>POS_A)) #define SETARG_A(i,u) ((i) = (((i)&MASK0(SIZE_A,POS_A)) | \ - ((Instruction)(u)<>POS_B) & MASK1(SIZE_B,0))) +#define GETARG_B(i) (cast(int, ((i)>>POS_B) & MASK1(SIZE_B,0))) #define SETARG_B(i,b) ((i) = (((i)&MASK0(SIZE_B,POS_B)) | \ - ((Instruction)(b)<>POS_C) & MASK1(SIZE_C,0))) +#define GETARG_C(i) (cast(int, ((i)>>POS_C) & MASK1(SIZE_C,0))) #define SETARG_C(i,b) ((i) = (((i)&MASK0(SIZE_C,POS_C)) | \ - ((Instruction)(b)<>POS_Bc) & MASK1(SIZE_Bc,0))) +#define GETARG_Bc(i) (cast(int, ((i)>>POS_Bc) & MASK1(SIZE_Bc,0))) #define SETARG_Bc(i,b) ((i) = (((i)&MASK0(SIZE_Bc,POS_Bc)) | \ - ((Instruction)(b)<