This commit is contained in:
Roberto Ierusalimschy
2003-01-27 11:00:43 -02:00
parent 83f0d6ef1a
commit 635b7c707d

View File

@@ -1,5 +1,5 @@
/* /*
** $Id: lobject.c,v 1.93 2002/11/21 15:16:04 roberto Exp roberto $ ** $Id: lobject.c,v 1.94 2002/12/04 17:38:31 roberto Exp roberto $
** Some generic functions over Lua objects ** Some generic functions over Lua objects
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -59,19 +59,19 @@ int luaO_log2 (unsigned int x) {
int luaO_rawequalObj (const TObject *t1, const TObject *t2) { int luaO_rawequalObj (const TObject *t1, const TObject *t2) {
if (ttype(t1) != ttype(t2)) return 0; if (ttype(t1) != ttype(t2)) return 0;
if (iscollectable(t1)) return gcvalue(t1) == gcvalue(t2);
else switch (ttype(t1)) { else switch (ttype(t1)) {
case LUA_TNIL: case LUA_TNIL:
return 1; return 1;
case LUA_TNUMBER:
return nvalue(t1) == nvalue(t2);
case LUA_TBOOLEAN: case LUA_TBOOLEAN:
return bvalue(t1) == bvalue(t2); /* boolean true must be 1 !! */ return bvalue(t1) == bvalue(t2); /* boolean true must be 1 !! */
case LUA_TLIGHTUSERDATA: case LUA_TLIGHTUSERDATA:
return pvalue(t1) == pvalue(t2); return pvalue(t1) == pvalue(t2);
case LUA_TNUMBER: default:
return nvalue(t1) == nvalue(t2); lua_assert(iscollectable(t1));
return gcvalue(t1) == gcvalue(t2);
} }
lua_assert(0);
return 0; /* to avoid warnings */
} }