diff options
Diffstat (limited to 'lcode.c')
-rw-r--r-- | lcode.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lcode.c,v 2.94 2014/10/30 18:53:28 roberto Exp roberto $ | 2 | ** $Id: lcode.c,v 2.95 2014/11/02 19:19:04 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 | */ |
@@ -768,12 +768,10 @@ static int validop (int op, TValue *v1, TValue *v2) { | |||
768 | (cast_void(tonumber(v2, &b)), b))) | 768 | (cast_void(tonumber(v2, &b)), b))) |
769 | return 0; | 769 | return 0; |
770 | switch (op) { | 770 | switch (op) { |
771 | case LUA_OPIDIV: /* division by 0 and conversion errors */ | ||
772 | return (tointeger(v1, &i) && tointeger(v2, &i) && i != 0); | ||
773 | case LUA_OPBAND: case LUA_OPBOR: case LUA_OPBXOR: | 771 | case LUA_OPBAND: case LUA_OPBOR: case LUA_OPBXOR: |
774 | case LUA_OPSHL: case LUA_OPSHR: case LUA_OPBNOT: /* conversion errors */ | 772 | case LUA_OPSHL: case LUA_OPSHR: case LUA_OPBNOT: /* conversion errors */ |
775 | return (tointeger(v1, &i) && tointeger(v2, &i)); | 773 | return (tointeger(v1, &i) && tointeger(v2, &i)); |
776 | case LUA_OPMOD: /* integer module by 0 */ | 774 | case LUA_OPIDIV: case LUA_OPMOD: /* integer division by 0 */ |
777 | return !(ttisinteger(v1) && ttisinteger(v2) && ivalue(v2) == 0); | 775 | return !(ttisinteger(v1) && ttisinteger(v2) && ivalue(v2) == 0); |
778 | default: return 1; /* everything else is valid */ | 776 | default: return 1; /* everything else is valid */ |
779 | } | 777 | } |