summaryrefslogtreecommitdiff
path: root/lvm.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-04-15 13:32:49 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-04-15 13:32:49 -0300
commit037a70dfea9de66e8d27c8d3ce2ed9f159a1b094 (patch)
treea31c77b6da44e543a1ec01f916e31d99fb64b238 /lvm.c
parent8f961da3dbf8c45389d1431e6dff8e44e41f1a57 (diff)
downloadlua-037a70dfea9de66e8d27c8d3ce2ed9f159a1b094.tar.gz
lua-037a70dfea9de66e8d27c8d3ce2ed9f159a1b094.tar.bz2
lua-037a70dfea9de66e8d27c8d3ce2ed9f159a1b094.zip
cast_u2s/cast_s2u renamed l_castS2U/l_castU2S to be configurable from
outside (mostly for testing)
Diffstat (limited to 'lvm.c')
-rw-r--r--lvm.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lvm.c b/lvm.c
index 4efc2949..653e6a16 100644
--- a/lvm.c
+++ b/lvm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lvm.c,v 2.196 2014/04/11 19:02:16 roberto Exp roberto $ 2** $Id: lvm.c,v 2.197 2014/04/15 14:28:20 roberto Exp roberto $
3** Lua virtual machine 3** Lua virtual machine
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -343,7 +343,7 @@ void luaV_objlen (lua_State *L, StkId ra, const TValue *rb) {
343 343
344 344
345lua_Integer luaV_div (lua_State *L, lua_Integer x, lua_Integer y) { 345lua_Integer luaV_div (lua_State *L, lua_Integer x, lua_Integer y) {
346 if (cast_s2u(y) + 1u <= 1u) { /* special cases: -1 or 0 */ 346 if (l_castS2U(y) + 1u <= 1u) { /* special cases: -1 or 0 */
347 if (y == 0) 347 if (y == 0)
348 luaG_runerror(L, "attempt to divide by zero"); 348 luaG_runerror(L, "attempt to divide by zero");
349 return intop(-, 0, x); /* y==-1; avoid overflow with 0x80000...//-1 */ 349 return intop(-, 0, x); /* y==-1; avoid overflow with 0x80000...//-1 */
@@ -359,7 +359,7 @@ lua_Integer luaV_div (lua_State *L, lua_Integer x, lua_Integer y) {
359 359
360 360
361lua_Integer luaV_mod (lua_State *L, lua_Integer x, lua_Integer y) { 361lua_Integer luaV_mod (lua_State *L, lua_Integer x, lua_Integer y) {
362 if (cast_s2u(y) + 1u <= 1u) { /* special cases: -1 or 0 */ 362 if (l_castS2U(y) + 1u <= 1u) { /* special cases: -1 or 0 */
363 if (y == 0) 363 if (y == 0)
364 luaG_runerror(L, "attempt to perform 'n%%0'"); 364 luaG_runerror(L, "attempt to perform 'n%%0'");
365 return 0; /* y==-1; avoid overflow with 0x80000...%-1 */ 365 return 0; /* y==-1; avoid overflow with 0x80000...%-1 */
@@ -792,7 +792,7 @@ void luaV_execute (lua_State *L) {
792 TValue *rb = RB(i); 792 TValue *rb = RB(i);
793 lua_Integer ib; 793 lua_Integer ib;
794 if (tointeger(rb, &ib)) { 794 if (tointeger(rb, &ib)) {
795 setivalue(ra, intop(^, ~cast_s2u(0), ib)); 795 setivalue(ra, intop(^, ~l_castS2U(0), ib));
796 } 796 }
797 else { 797 else {
798 Protect(luaT_trybinTM(L, rb, rb, ra, TM_BNOT)); 798 Protect(luaT_trybinTM(L, rb, rb, ra, TM_BNOT));