diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-01-26 12:16:35 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-01-26 12:16:35 -0200 |
commit | ac390020e91e14f00200ad3df97682b715d3e59b (patch) | |
tree | e86c7128814f6c754e9bebf4bbdad08ba4e8aeff /lobject.c | |
parent | 9b45439860879dd282e6d0896c4ee8102febc7fd (diff) | |
download | lua-github-ac390020e91e14f00200ad3df97682b715d3e59b.tar.gz |
optimizations based on all types but number and nil are pointers
Diffstat (limited to 'lobject.c')
-rw-r--r-- | lobject.c | 13 |
1 files changed, 4 insertions, 9 deletions
@@ -1,5 +1,5 @@ /* -** $Id: lobject.c,v 1.60 2001/01/24 15:45:33 roberto Exp roberto $ +** $Id: lobject.c,v 1.61 2001/01/25 16:45:36 roberto Exp roberto $ ** Some generic functions over Lua objects ** See Copyright Notice in lua.h */ @@ -37,15 +37,10 @@ int luaO_equalObj (const TObject *t1, const TObject *t2) { switch (ttype(t1)) { case LUA_TNUMBER: return nvalue(t1) == nvalue(t2); - case LUA_TSTRING: case LUA_TUSERDATA: + case LUA_TNIL: + return 1; + default: /* all other types are equal if pointers are equal */ return tsvalue(t1) == tsvalue(t2); - case LUA_TTABLE: - return hvalue(t1) == hvalue(t2); - case LUA_TFUNCTION: - return clvalue(t1) == clvalue(t2); - default: - lua_assert(ttype(t1) == LUA_TNIL); - return 1; /* LUA_TNIL */ } } |