浏览代码

small bug when creating AsBc instructions in 16-bit machines

Roberto Ierusalimschy 24 年之前
父节点
当前提交
95988676d8
共有 3 个文件被更改,包括 6 次插入6 次删除
  1. 2 2
      lcode.c
  2. 2 2
      lcode.h
  3. 2 2
      lopcodes.h

+ 2 - 2
lcode.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lcode.c,v 1.76 2001/06/15 20:36:57 roberto Exp roberto $
+** $Id: lcode.c,v 1.77 2001/07/17 14:30:44 roberto Exp roberto $
 ** Code generator for Lua
 ** See Copyright Notice in lua.h
 */
@@ -794,7 +794,7 @@ int luaK_codeABC (FuncState *fs, OpCode o, int a, int b, int c) {
 }
 
 
-int luaK_codeABc (FuncState *fs, OpCode o, int a, int bc) {
+int luaK_codeABc (FuncState *fs, OpCode o, int a, unsigned int bc) {
   lua_assert(getOpMode(o) == iABc || getOpMode(o) == iAsBc);
   return luaK_code(fs, CREATE_ABc(o, a, bc));
 }

+ 2 - 2
lcode.h

@@ -1,5 +1,5 @@
 /*
-** $Id: lcode.h,v 1.22 2001/06/05 18:17:01 roberto Exp roberto $
+** $Id: lcode.h,v 1.23 2001/06/12 14:36:48 roberto Exp roberto $
 ** Code generator for Lua
 ** See Copyright Notice in lua.h
 */
@@ -39,7 +39,7 @@ typedef enum UnOpr { OPR_MINUS, OPR_NOT, OPR_NOUNOPR } UnOpr;
 #define luaK_codeAsBc(fs,o,A,sBc)	luaK_codeABc(fs,o,A,(sBc)+MAXARG_sBc)
 
 void luaK_error (LexState *ls, const l_char *msg);
-int luaK_codeABc (FuncState *fs, OpCode o, int A, int Bc);
+int luaK_codeABc (FuncState *fs, OpCode o, int A, unsigned int Bc);
 int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C);
 void luaK_nil (FuncState *fs, int from, int n);
 void luaK_reserveregs (FuncState *fs, int n);

+ 2 - 2
lopcodes.h

@@ -1,5 +1,5 @@
 /*
-** $Id: lopcodes.h,v 1.76 2001/06/28 19:58:57 roberto Exp roberto $
+** $Id: lopcodes.h,v 1.77 2001/07/03 17:01:34 roberto Exp roberto $
 ** Opcodes for Lua virtual machine
 ** See Copyright Notice in lua.h
 */
@@ -96,7 +96,7 @@ enum OpMode {iABC, iABc, iAsBc};  /* basic instruction format */
                                ((Instruction)(b)<<POS_Bc)))
 
 #define GETARG_sBc(i)	(GETARG_Bc(i)-MAXARG_sBc)
-#define SETARG_sBc(i,b)	SETARG_Bc((i),(b)+MAXARG_sBc)
+#define SETARG_sBc(i,b)	SETARG_Bc((i),(unsigned int)((b)+MAXARG_sBc))
 
 
 #define CREATE_ABC(o,a,b,c)	((Instruction)(o) \