|
@ -1,5 +1,5 @@ |
|
|
/*
|
|
|
/*
|
|
|
** $Id: lvm.c,v 2.190 2014/03/15 12:29:48 roberto Exp roberto $ |
|
|
** $Id: lvm.c,v 2.191 2014/03/31 18:37:52 roberto Exp roberto $ |
|
|
** Lua virtual machine |
|
|
** Lua virtual machine |
|
|
** See Copyright Notice in lua.h |
|
|
** See Copyright Notice in lua.h |
|
|
*/ |
|
|
*/ |
|
@ -325,7 +325,7 @@ void luaV_objlen (lua_State *L, StkId ra, const TValue *rb) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lua_Integer luaV_div (lua_State *L, lua_Integer x, lua_Integer y) { |
|
|
lua_Integer luaV_div (lua_State *L, lua_Integer x, lua_Integer y) { |
|
|
if (cast_unsigned(y) + 1 <= 1U) { /* special cases: -1 or 0 */ |
|
|
if (cast_unsigned(y) + 1 <= 1u) { /* special cases: -1 or 0 */ |
|
|
if (y == 0) |
|
|
if (y == 0) |
|
|
luaG_runerror(L, "attempt to divide by zero"); |
|
|
luaG_runerror(L, "attempt to divide by zero"); |
|
|
return intop(-, 0, x); /* y==-1; avoid overflow with 0x80000...//-1 */ |
|
|
return intop(-, 0, x); /* y==-1; avoid overflow with 0x80000...//-1 */ |
|
@ -341,7 +341,7 @@ lua_Integer luaV_div (lua_State *L, lua_Integer x, lua_Integer y) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lua_Integer luaV_mod (lua_State *L, lua_Integer x, lua_Integer y) { |
|
|
lua_Integer luaV_mod (lua_State *L, lua_Integer x, lua_Integer y) { |
|
|
if (cast_unsigned(y) + 1 <= 1U) { /* special cases: -1 or 0 */ |
|
|
if (cast_unsigned(y) + 1 <= 1u) { /* special cases: -1 or 0 */ |
|
|
if (y == 0) |
|
|
if (y == 0) |
|
|
luaG_runerror(L, "attempt to perform 'n%%0'"); |
|
|
luaG_runerror(L, "attempt to perform 'n%%0'"); |
|
|
return 0; /* y==-1; avoid overflow with 0x80000...%-1 */ |
|
|
return 0; /* y==-1; avoid overflow with 0x80000...%-1 */ |
|
|