From dfe2f1eeff07b0fc42f6a4255624e704d9c9beb5 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 7 Aug 2006 16:14:30 -0300 Subject: macros luai_num* take a state L (when available) as argument, to allow them to generate errors (and other facilities) --- lcode.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'lcode.c') diff --git a/lcode.c b/lcode.c index ca4e884f..68b1bfe2 100644 --- a/lcode.c +++ b/lcode.c @@ -1,5 +1,5 @@ /* -** $Id: lcode.c,v 2.25 2006/03/21 19:28:49 roberto Exp roberto $ +** $Id: lcode.c,v 2.26 2006/06/22 16:12:59 roberto Exp roberto $ ** Code generator for Lua ** See Copyright Notice in lua.h */ @@ -637,21 +637,21 @@ static int constfolding (OpCode op, expdesc *e1, expdesc *e2) { v1 = e1->u.nval; v2 = e2->u.nval; switch (op) { - case OP_ADD: r = luai_numadd(v1, v2); break; - case OP_SUB: r = luai_numsub(v1, v2); break; - case OP_MUL: r = luai_nummul(v1, v2); break; + case OP_ADD: r = luai_numadd(NULL, v1, v2); break; + case OP_SUB: r = luai_numsub(NULL, v1, v2); break; + case OP_MUL: r = luai_nummul(NULL, v1, v2); break; case OP_DIV: if (v2 == 0) return 0; /* do not attempt to divide by 0 */ - r = luai_numdiv(v1, v2); break; + r = luai_numdiv(NULL, v1, v2); break; case OP_MOD: if (v2 == 0) return 0; /* do not attempt to divide by 0 */ - r = luai_nummod(v1, v2); break; - case OP_POW: r = luai_numpow(v1, v2); break; - case OP_UNM: r = luai_numunm(v1); break; + r = luai_nummod(NULL, v1, v2); break; + case OP_POW: r = luai_numpow(NULL, v1, v2); break; + case OP_UNM: r = luai_numunm(NULL, v1); break; case OP_LEN: return 0; /* no constant folding for 'len' */ default: lua_assert(0); r = 0; break; } - if (luai_numisnan(r)) return 0; /* do not attempt to produce NaN */ + if (luai_numisnan(NULL, r)) return 0; /* do not attempt to produce NaN */ e1->u.nval = r; return 1; } -- cgit v1.2.3-55-g6feb