Browse Source

words are stored in hi-lo order (easier to print)

Roberto Ierusalimschy 27 years ago
parent
commit
d470792517
2 changed files with 5 additions and 5 deletions
  1. 3 3
      lua.stx
  2. 2 2
      lvm.c

+ 3 - 3
lua.stx

@@ -1,6 +1,6 @@
 %{
 %{
 /*
 /*
-** $Id: lua.stx,v 1.35 1998/03/09 21:49:52 roberto Exp roberto $
+** $Id: lua.stx,v 1.36 1998/03/25 18:52:29 roberto Exp roberto $
 ** Syntax analizer and code generator
 ** Syntax analizer and code generator
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -149,8 +149,8 @@ static int code_oparg_at (int pc, OpCode op, int builtin, int arg, int delta)
   }
   }
   else if (arg <= MAX_WORD) {
   else if (arg <= MAX_WORD) {
     code[pc] = op+1+builtin;
     code[pc] = op+1+builtin;
-    code[pc+1] = arg&0xFF;
-    code[pc+2] = arg>>8;
+    code[pc+1] = arg>>8;
+    code[pc+2] = arg&0xFF;
     return 3;
     return 3;
   }
   }
   else luaY_error("code too long " MES_LIM("64K"));
   else luaY_error("code too long " MES_LIM("64K"));

+ 2 - 2
lvm.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: lvm.c,v 1.26 1998/03/11 13:59:50 roberto Exp roberto $
+** $Id: lvm.c,v 1.27 1998/03/25 18:52:29 roberto Exp roberto $
 ** Lua virtual machine
 ** Lua virtual machine
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -28,7 +28,7 @@
 
 
 
 
 #define skip_word(pc)	(pc+=2)
 #define skip_word(pc)	(pc+=2)
-#define get_word(pc)	(*(pc)+(*((pc)+1)<<8))
+#define get_word(pc)	((*(pc)<<8)+(*((pc)+1)))
 #define next_word(pc)   (pc+=2, get_word(pc-2))
 #define next_word(pc)   (pc+=2, get_word(pc-2))