aboutsummaryrefslogtreecommitdiff
path: root/lopcodes.h
diff options
context:
space:
mode:
Diffstat (limited to 'lopcodes.h')
-rw-r--r--lopcodes.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/lopcodes.h b/lopcodes.h
index 16f22d45..c822049c 100644
--- a/lopcodes.h
+++ b/lopcodes.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lopcodes.h,v 1.41 2000/02/22 13:30:11 roberto Exp roberto $ 2** $Id: lopcodes.h,v 1.42 2000/03/02 12:32:53 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*/
@@ -21,9 +21,11 @@
21 2nd unsigned argument in the middle 8 bits (`B') 21 2nd unsigned argument in the middle 8 bits (`B')
22 22
23 The signed argument is represented in excess 2^23; that is, the real value 23 The signed argument is represented in excess 2^23; that is, the real value
24 is 2^23 minus the usigned value. 24 is the usigned value minus 2^23.
25===========================================================================*/ 25===========================================================================*/
26 26
27#define EXCESS_S (1<<23) /* == 2^23 */
28
27/* 29/*
28** the following macros help to manipulate instructions 30** the following macros help to manipulate instructions
29*/ 31*/
@@ -35,13 +37,13 @@
35 37
36#define GET_OPCODE(i) ((OpCode)((i)&0xFF)) 38#define GET_OPCODE(i) ((OpCode)((i)&0xFF))
37#define GETARG_U(i) ((int)((i)>>8)) 39#define GETARG_U(i) ((int)((i)>>8))
38#define GETARG_S(i) ((int)((i)>>8)-(1<<23)) 40#define GETARG_S(i) ((int)((i)>>8)-EXCESS_S)
39#define GETARG_A(i) ((int)((i)>>16)) 41#define GETARG_A(i) ((int)((i)>>16))
40#define GETARG_B(i) ((int)(((i)>>8) & 0xFF)) 42#define GETARG_B(i) ((int)(((i)>>8) & 0xFF))
41 43
42#define SET_OPCODE(i,o) (((i)&0xFFFFFF00u) | (Instruction)(o)) 44#define SET_OPCODE(i,o) (((i)&0xFFFFFF00u) | (Instruction)(o))
43#define SETARG_U(i,u) (((i)&0x000000FFu) | ((Instruction)(u)<<8)) 45#define SETARG_U(i,u) (((i)&0x000000FFu) | ((Instruction)(u)<<8))
44#define SETARG_S(i,s) (((i)&0x000000FFu) | ((Instruction)((s)+(1<<23))<<8)) 46#define SETARG_S(i,s) (((i)&0x000000FFu) | ((Instruction)((s)+EXCESS_S)<<8))
45#define SETARG_A(i,a) (((i)&0x0000FFFFu) | ((Instruction)(a)<<16)) 47#define SETARG_A(i,a) (((i)&0x0000FFFFu) | ((Instruction)(a)<<16))
46#define SETARG_B(i,b) (((i)&0xFFFF00FFu) | ((Instruction)(b)<<8)) 48#define SETARG_B(i,b) (((i)&0xFFFF00FFu) | ((Instruction)(b)<<8))
47 49
@@ -55,8 +57,9 @@
55*/ 57*/
56 58
57typedef enum { 59typedef enum {
58/* name parm before after side effect 60/*----------------------------------------------------------------------
59-----------------------------------------------------------------------------*/ 61name args stack before stack after side effects
62------------------------------------------------------------------------*/
60ENDCODE,/* - - (return) */ 63ENDCODE,/* - - (return) */
61RETCODE,/* U - (return) */ 64RETCODE,/* U - (return) */
62 65