aboutsummaryrefslogtreecommitdiff
path: root/ltests.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-12-30 18:47:58 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-12-30 18:47:58 -0200
commit1ea2d20f74cea9c61817d4a5ed67c4fc47cafb51 (patch)
treebdedb3205963f8db43391aaef5be853cdeb59df4 /ltests.c
parentf5133aa1a55cee96b535ff788764437deacdc26a (diff)
downloadlua-1ea2d20f74cea9c61817d4a5ed67c4fc47cafb51.tar.gz
lua-1ea2d20f74cea9c61817d4a5ed67c4fc47cafb51.tar.bz2
lua-1ea2d20f74cea9c61817d4a5ed67c4fc47cafb51.zip
first implementation of '<<', '>>', and '~' (bitwise not)
Diffstat (limited to 'ltests.c')
-rw-r--r--ltests.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/ltests.c b/ltests.c
index 1dccc934..d062d167 100644
--- a/ltests.c
+++ b/ltests.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltests.c,v 2.160 2013/12/16 19:06:52 roberto Exp roberto $ 2** $Id: ltests.c,v 2.161 2013/12/18 14:12:03 roberto Exp roberto $
3** Internal Module for Debugging of the Lua Implementation 3** Internal Module for Debugging of the Lua Implementation
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -1023,6 +1023,16 @@ static void pushcode (lua_State *L, int code) {
1023static int testC (lua_State *L); 1023static int testC (lua_State *L);
1024static int Cfunck (lua_State *L); 1024static int Cfunck (lua_State *L);
1025 1025
1026/*
1027** arithmetic operation encoding for 'arith' instruction
1028** LUA_OPIDIV -> \
1029** LUA_OPSHL -> <
1030** LUA_OPSHR -> >
1031** LUA_OPUNM -> _
1032** LUA_OPBNOT -> !
1033*/
1034static char ops[] = "+-*%^/\\&|~<>_!";
1035
1026static int runC (lua_State *L, lua_State *L1, const char *pc) { 1036static int runC (lua_State *L, lua_State *L1, const char *pc) {
1027 char buff[300]; 1037 char buff[300];
1028 int status = 0; 1038 int status = 0;
@@ -1198,7 +1208,6 @@ static int runC (lua_State *L, lua_State *L1, const char *pc) {
1198 } 1208 }
1199 } 1209 }
1200 else if EQ("arith") { 1210 else if EQ("arith") {
1201 static char ops[] = "+-*%^/\\&|~_"; /* '\' -> '//'; '_' -> '..' */
1202 int op; 1211 int op;
1203 skip(&pc); 1212 skip(&pc);
1204 op = strchr(ops, *pc++) - ops; 1213 op = strchr(ops, *pc++) - ops;