From 2b83711fbac0509a40cfb616b9a68bdf683e8471 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 19 Dec 2014 11:36:32 -0200 Subject: new macro 'nvalue' (to convert an object to a float when we know object is a number) --- lcode.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'lcode.c') diff --git a/lcode.c b/lcode.c index ddbc6522..f84b7b6b 100644 --- a/lcode.c +++ b/lcode.c @@ -1,5 +1,5 @@ /* -** $Id: lcode.c,v 2.96 2014/11/21 12:15:57 roberto Exp roberto $ +** $Id: lcode.c,v 2.97 2014/11/24 14:59:22 roberto Exp roberto $ ** Code generator for Lua ** See Copyright Notice in lua.h */ @@ -761,12 +761,8 @@ void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) { ** return false if folding can raise an error */ static int validop (int op, TValue *v1, TValue *v2) { - lua_Number a, b; lua_Integer i; - cast_void(a); cast_void(b); /* macro may not use its arguments */ - if (luai_numinvalidop(op, (cast_void(tonumber(v1, &a)), a), - (cast_void(tonumber(v2, &b)), b))) - return 0; + if (luai_numinvalidop(op, nvalue(v1), nvalue(v2))) return 0; switch (op) { case LUA_OPBAND: case LUA_OPBOR: case LUA_OPBXOR: case LUA_OPSHL: case LUA_OPSHR: case LUA_OPBNOT: /* conversion errors */ -- cgit v1.2.3-55-g6feb