mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-04-20 22:13:25 +00:00
x64: Optimize internal/external tag conversion in lua_type().
This commit is contained in:
parent
5dcf630c54
commit
5140b40b44
@ -196,7 +196,11 @@ LUA_API int lua_type(lua_State *L, int idx)
|
||||
return LUA_TNONE;
|
||||
} else { /* Magic internal/external tag conversion. ORDER LJ_T */
|
||||
uint32_t t = ~itype(o);
|
||||
#if LJ_64
|
||||
int tt = (int)((U64x(7506,98042110) >> 4*t) & 15u);
|
||||
#else
|
||||
int tt = (int)(((t < 8 ? 0x98042110 : 0x7506) >> 4*(t&7)) & 15u);
|
||||
#endif
|
||||
lua_assert(tt != LUA_TNIL || tvisnil(o));
|
||||
return tt;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user