diff options
| -rw-r--r-- | lcode.c | 6 |
1 files changed, 3 insertions, 3 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lcode.c,v 2.34 2007/05/04 18:41:49 roberto Exp roberto $ | 2 | ** $Id: lcode.c,v 2.35 2008/04/02 16:16:06 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 | */ |
| @@ -696,8 +696,8 @@ void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e) { | |||
| 696 | e2.t = e2.f = NO_JUMP; e2.k = VKNUM; e2.u.nval = 0; | 696 | e2.t = e2.f = NO_JUMP; e2.k = VKNUM; e2.u.nval = 0; |
| 697 | switch (op) { | 697 | switch (op) { |
| 698 | case OPR_MINUS: { | 698 | case OPR_MINUS: { |
| 699 | if (isnumeral(e)) /* -constant? */ | 699 | if (isnumeral(e) && e->u.nval != 0) /* minus non-zero constant? */ |
| 700 | e->u.nval = luai_numunm(NULL, e->u.nval); | 700 | e->u.nval = luai_numunm(NULL, e->u.nval); /* fold it */ |
| 701 | else { | 701 | else { |
| 702 | luaK_exp2anyreg(fs, e); | 702 | luaK_exp2anyreg(fs, e); |
| 703 | codearith(fs, OP_UNM, e, &e2); | 703 | codearith(fs, OP_UNM, e, &e2); |
