aboutsummaryrefslogtreecommitdiff
path: root/lcode.c
diff options
context:
space:
mode:
Diffstat (limited to 'lcode.c')
-rw-r--r--lcode.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/lcode.c b/lcode.c
index ca4e884f..68b1bfe2 100644
--- a/lcode.c
+++ b/lcode.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lcode.c,v 2.25 2006/03/21 19:28:49 roberto Exp roberto $ 2** $Id: lcode.c,v 2.26 2006/06/22 16:12:59 roberto Exp roberto $
3** Code generator for Lua 3** Code generator for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -637,21 +637,21 @@ static int constfolding (OpCode op, expdesc *e1, expdesc *e2) {
637 v1 = e1->u.nval; 637 v1 = e1->u.nval;
638 v2 = e2->u.nval; 638 v2 = e2->u.nval;
639 switch (op) { 639 switch (op) {
640 case OP_ADD: r = luai_numadd(v1, v2); break; 640 case OP_ADD: r = luai_numadd(NULL, v1, v2); break;
641 case OP_SUB: r = luai_numsub(v1, v2); break; 641 case OP_SUB: r = luai_numsub(NULL, v1, v2); break;
642 case OP_MUL: r = luai_nummul(v1, v2); break; 642 case OP_MUL: r = luai_nummul(NULL, v1, v2); break;
643 case OP_DIV: 643 case OP_DIV:
644 if (v2 == 0) return 0; /* do not attempt to divide by 0 */ 644 if (v2 == 0) return 0; /* do not attempt to divide by 0 */
645 r = luai_numdiv(v1, v2); break; 645 r = luai_numdiv(NULL, v1, v2); break;
646 case OP_MOD: 646 case OP_MOD:
647 if (v2 == 0) return 0; /* do not attempt to divide by 0 */ 647 if (v2 == 0) return 0; /* do not attempt to divide by 0 */
648 r = luai_nummod(v1, v2); break; 648 r = luai_nummod(NULL, v1, v2); break;
649 case OP_POW: r = luai_numpow(v1, v2); break; 649 case OP_POW: r = luai_numpow(NULL, v1, v2); break;
650 case OP_UNM: r = luai_numunm(v1); break; 650 case OP_UNM: r = luai_numunm(NULL, v1); break;
651 case OP_LEN: return 0; /* no constant folding for 'len' */ 651 case OP_LEN: return 0; /* no constant folding for 'len' */
652 default: lua_assert(0); r = 0; break; 652 default: lua_assert(0); r = 0; break;
653 } 653 }
654 if (luai_numisnan(r)) return 0; /* do not attempt to produce NaN */ 654 if (luai_numisnan(NULL, r)) return 0; /* do not attempt to produce NaN */
655 e1->u.nval = r; 655 e1->u.nval = r;
656 return 1; 656 return 1;
657} 657}