summaryrefslogtreecommitdiff
path: root/src/lj_api.c
diff options
context:
space:
mode:
authorMike Pall <mike>2010-04-25 23:21:15 +0200
committerMike Pall <mike>2010-04-25 23:21:15 +0200
commit41379126a2e41179068800f5ab791cc84f740228 (patch)
treed973dc7a6e89b3f67b0438e2bdae7c46fe24a26a /src/lj_api.c
parentf396f3d192eb635b3b3a3d074e45e6b810689918 (diff)
downloadluajit2-41379126a2e41179068800f5ab791cc84f740228.tar.gz
Treat the tag of a TValue as unsigned everywhere.
Diffstat (limited to 'src/lj_api.c')
-rw-r--r--src/lj_api.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lj_api.c b/src/lj_api.c
index 2b99c267..b9bac1d4 100644
--- a/src/lj_api.c
+++ b/src/lj_api.c
@@ -195,9 +195,10 @@ LUA_API int lua_type(lua_State *L, int idx)
} else if (o == niltv(L)) {
return LUA_TNONE;
} else { /* Magic internal/external tag conversion. ORDER LJ_T */
- int t = ~itype(o);
- lua_assert(itype(o) != LJ_TUPVAL);
- return (int)(((t < 8 ? 0x98042110 : 0x7506) >> 4*(t&7)) & 15u);
+ uint32_t t = ~itype(o);
+ int tt = (int)(((t < 8 ? 0x98042110 : 0x7506) >> 4*(t&7)) & 15u);
+ lua_assert(tt != LUA_TNIL || tvisnil(o));
+ return tt;
}
}