aboutsummaryrefslogtreecommitdiff
path: root/lapi.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-08-31 16:46:07 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-08-31 16:46:07 -0300
commite1d072571ec6f9d830e575a2ecdc95fd43428e53 (patch)
tree830fab7f2acb9adaee2d63073d339cc9557a5437 /lapi.c
parent7651a5c6b2ee6ec59cadec6199319d482071f176 (diff)
downloadlua-e1d072571ec6f9d830e575a2ecdc95fd43428e53.tar.gz
lua-e1d072571ec6f9d830e575a2ecdc95fd43428e53.tar.bz2
lua-e1d072571ec6f9d830e575a2ecdc95fd43428e53.zip
better syntax for type casts
Diffstat (limited to 'lapi.c')
-rw-r--r--lapi.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lapi.c b/lapi.c
index a349c657..7c2f5d52 100644
--- a/lapi.c
+++ b/lapi.c
@@ -544,8 +544,8 @@ LUA_API int lua_dostring (lua_State *L, const l_char *str) {
544*/ 544*/
545 545
546/* GC values are expressed in Kbytes: #bytes/2^10 */ 546/* GC values are expressed in Kbytes: #bytes/2^10 */
547#define GCscale(x) ((int)((x)>>10)) 547#define GCscale(x) (cast(int, (x)>>10))
548#define GCunscale(x) ((lu_mem)(x)<<10) 548#define GCunscale(x) (cast(lu_mem, (x)<<10))
549 549
550LUA_API int lua_getgcthreshold (lua_State *L) { 550LUA_API int lua_getgcthreshold (lua_State *L) {
551 int threshold; 551 int threshold;
@@ -602,7 +602,7 @@ LUA_API int lua_name2tag (lua_State *L, const l_char *name) {
602 tag = LUA_TNONE; 602 tag = LUA_TNONE;
603 else { 603 else {
604 lua_assert(ttype(v) == LUA_TNUMBER); 604 lua_assert(ttype(v) == LUA_TNUMBER);
605 tag = (int)nvalue(v); 605 tag = cast(int, nvalue(v));
606 } 606 }
607 lua_unlock(L); 607 lua_unlock(L);
608 return tag; 608 return tag;
@@ -695,7 +695,7 @@ LUA_API int lua_getn (lua_State *L, int index) {
695 api_check(L, ttype(t) == LUA_TTABLE); 695 api_check(L, ttype(t) == LUA_TTABLE);
696 value = luaH_getstr(hvalue(t), luaS_newliteral(L, l_s("n"))); /* = t.n */ 696 value = luaH_getstr(hvalue(t), luaS_newliteral(L, l_s("n"))); /* = t.n */
697 if (ttype(value) == LUA_TNUMBER) 697 if (ttype(value) == LUA_TNUMBER)
698 n = (int)nvalue(value); 698 n = cast(int, nvalue(value));
699 else { 699 else {
700 lua_Number max = 0; 700 lua_Number max = 0;
701 int i = hvalue(t)->size; 701 int i = hvalue(t)->size;
@@ -707,7 +707,7 @@ LUA_API int lua_getn (lua_State *L, int index) {
707 max = nvalue(key(nd)); 707 max = nvalue(key(nd));
708 nd++; 708 nd++;
709 } 709 }
710 n = (int)max; 710 n = cast(int, max);
711 } 711 }
712 lua_unlock(L); 712 lua_unlock(L);
713 return n; 713 return n;