From 3c9d999424520c809e05bee11d81788b488434f6 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 3 Mar 2000 11:58:26 -0300 Subject: many details (most by lhf). --- lopcodes.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'lopcodes.h') diff --git a/lopcodes.h b/lopcodes.h index 16f22d45..c822049c 100644 --- a/lopcodes.h +++ b/lopcodes.h @@ -1,5 +1,5 @@ /* -** $Id: lopcodes.h,v 1.41 2000/02/22 13:30:11 roberto Exp roberto $ +** $Id: lopcodes.h,v 1.42 2000/03/02 12:32:53 roberto Exp roberto $ ** Opcodes for Lua virtual machine ** See Copyright Notice in lua.h */ @@ -21,9 +21,11 @@ 2nd unsigned argument in the middle 8 bits (`B') The signed argument is represented in excess 2^23; that is, the real value - is 2^23 minus the usigned value. + is the usigned value minus 2^23. ===========================================================================*/ +#define EXCESS_S (1<<23) /* == 2^23 */ + /* ** the following macros help to manipulate instructions */ @@ -35,13 +37,13 @@ #define GET_OPCODE(i) ((OpCode)((i)&0xFF)) #define GETARG_U(i) ((int)((i)>>8)) -#define GETARG_S(i) ((int)((i)>>8)-(1<<23)) +#define GETARG_S(i) ((int)((i)>>8)-EXCESS_S) #define GETARG_A(i) ((int)((i)>>16)) #define GETARG_B(i) ((int)(((i)>>8) & 0xFF)) #define SET_OPCODE(i,o) (((i)&0xFFFFFF00u) | (Instruction)(o)) #define SETARG_U(i,u) (((i)&0x000000FFu) | ((Instruction)(u)<<8)) -#define SETARG_S(i,s) (((i)&0x000000FFu) | ((Instruction)((s)+(1<<23))<<8)) +#define SETARG_S(i,s) (((i)&0x000000FFu) | ((Instruction)((s)+EXCESS_S)<<8)) #define SETARG_A(i,a) (((i)&0x0000FFFFu) | ((Instruction)(a)<<16)) #define SETARG_B(i,b) (((i)&0xFFFF00FFu) | ((Instruction)(b)<<8)) @@ -55,8 +57,9 @@ */ typedef enum { -/* name parm before after side effect ------------------------------------------------------------------------------*/ +/*---------------------------------------------------------------------- +name args stack before stack after side effects +------------------------------------------------------------------------*/ ENDCODE,/* - - (return) */ RETCODE,/* U - (return) */ -- cgit v1.2.3-55-g6feb