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-ac390020e91e14f00200ad3df97682b715d3e59b.tar.gz lua-ac390020e91e14f00200ad3df97682b715d3e59b.tar.bz2 lua-ac390020e91e14f00200ad3df97682b715d3e59b.zip | |
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 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lobject.c,v 1.60 2001/01/24 15:45:33 roberto Exp roberto $ | 2 | ** $Id: lobject.c,v 1.61 2001/01/25 16:45:36 roberto Exp roberto $ |
| 3 | ** Some generic functions over Lua objects | 3 | ** Some generic functions over Lua objects |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -37,15 +37,10 @@ int luaO_equalObj (const TObject *t1, const TObject *t2) { | |||
| 37 | switch (ttype(t1)) { | 37 | switch (ttype(t1)) { |
| 38 | case LUA_TNUMBER: | 38 | case LUA_TNUMBER: |
| 39 | return nvalue(t1) == nvalue(t2); | 39 | return nvalue(t1) == nvalue(t2); |
| 40 | case LUA_TSTRING: case LUA_TUSERDATA: | 40 | case LUA_TNIL: |
| 41 | return 1; | ||
| 42 | default: /* all other types are equal if pointers are equal */ | ||
| 41 | return tsvalue(t1) == tsvalue(t2); | 43 | return tsvalue(t1) == tsvalue(t2); |
| 42 | case LUA_TTABLE: | ||
| 43 | return hvalue(t1) == hvalue(t2); | ||
| 44 | case LUA_TFUNCTION: | ||
| 45 | return clvalue(t1) == clvalue(t2); | ||
| 46 | default: | ||
| 47 | lua_assert(ttype(t1) == LUA_TNIL); | ||
| 48 | return 1; /* LUA_TNIL */ | ||
| 49 | } | 44 | } |
| 50 | } | 45 | } |
| 51 | 46 | ||
