aboutsummaryrefslogtreecommitdiff
path: root/lapi.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-04-15 11:29:30 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-04-15 11:29:30 -0300
commit8f961da3dbf8c45389d1431e6dff8e44e41f1a57 (patch)
treeee67fa31c29eab0569c35c62b17f43092f60d940 /lapi.c
parent5c46b7b8cf3a71cce5572b1fca84542e24723efd (diff)
downloadlua-8f961da3dbf8c45389d1431e6dff8e44e41f1a57.tar.gz
lua-8f961da3dbf8c45389d1431e6dff8e44e41f1a57.tar.bz2
lua-8f961da3dbf8c45389d1431e6dff8e44e41f1a57.zip
macros cast_integer/cast_unsigned replaced by cast_u2s/cast_s2u, that
should be used only between lua_Integer and lua_Unsigned
Diffstat (limited to 'lapi.c')
-rw-r--r--lapi.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lapi.c b/lapi.c
index c58ff807..dc620081 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 2.202 2014/04/01 18:51:23 roberto Exp roberto $ 2** $Id: lapi.c,v 2.203 2014/04/12 14:45:10 roberto Exp roberto $
3** Lua API 3** Lua API
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -376,7 +376,7 @@ LUA_API lua_Unsigned lua_tounsignedx (lua_State *L, int idx, int *pisnum) {
376 int isnum = 0; 376 int isnum = 0;
377 switch (ttype(o)) { 377 switch (ttype(o)) {
378 case LUA_TNUMINT: { 378 case LUA_TNUMINT: {
379 res = cast_unsigned(ivalue(o)); 379 res = cast_s2u(ivalue(o));
380 isnum = 1; 380 isnum = 1;
381 break; 381 break;
382 } 382 }
@@ -392,7 +392,7 @@ LUA_API lua_Unsigned lua_tounsignedx (lua_State *L, int idx, int *pisnum) {
392 n = l_mathop(fmod)(n, two2n); /* n = n % 2^(numbits in an integer) */ 392 n = l_mathop(fmod)(n, two2n); /* n = n % 2^(numbits in an integer) */
393 if (luai_numisnan(n)) /* not a number? */ 393 if (luai_numisnan(n)) /* not a number? */
394 break; /* not an integer, too */ 394 break; /* not an integer, too */
395 res = cast_unsigned(n); /* 'n' now must fit in an unsigned */ 395 res = cast(lua_Unsigned, n); /* 'n' now must fit in an unsigned */
396 if (neg) res = 0u - res; /* back to negative, if needed */ 396 if (neg) res = 0u - res; /* back to negative, if needed */
397 isnum = 1; 397 isnum = 1;
398 break; 398 break;
@@ -514,7 +514,7 @@ LUA_API void lua_pushinteger (lua_State *L, lua_Integer n) {
514 514
515LUA_API void lua_pushunsigned (lua_State *L, lua_Unsigned u) { 515LUA_API void lua_pushunsigned (lua_State *L, lua_Unsigned u) {
516 lua_lock(L); 516 lua_lock(L);
517 setivalue(L->top, cast_integer(u)); 517 setivalue(L->top, cast_u2s(u));
518 api_incr_top(L); 518 api_incr_top(L);
519 lua_unlock(L); 519 lua_unlock(L);
520} 520}