mirror of
https://github.com/lua/lua.git
synced 2024-11-23 18:23:43 +08:00
new macro 'ttisequal'
This commit is contained in:
parent
0fb1644c60
commit
5286650894
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lobject.c,v 2.45 2010/12/10 19:03:46 roberto Exp roberto $
|
||||
** $Id: lobject.c,v 2.46 2011/02/07 19:15:24 roberto Exp roberto $
|
||||
** Some generic functions over Lua objects
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -71,7 +71,7 @@ int luaO_ceillog2 (unsigned int x) {
|
||||
|
||||
|
||||
int luaO_rawequalObj (const TValue *t1, const TValue *t2) {
|
||||
if (ttype(t1) != ttype(t2)) return 0;
|
||||
if (!ttisequal(t1, t2)) return 0;
|
||||
else switch (ttype(t1)) {
|
||||
case LUA_TNIL:
|
||||
return 1;
|
||||
|
4
lvm.c
4
lvm.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lvm.c,v 2.131 2011/02/07 19:15:24 roberto Exp roberto $
|
||||
** $Id: lvm.c,v 2.132 2011/04/05 14:26:23 roberto Exp roberto $
|
||||
** Lua virtual machine
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -239,7 +239,7 @@ int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r) {
|
||||
|
||||
int luaV_equalval_ (lua_State *L, const TValue *t1, const TValue *t2) {
|
||||
const TValue *tm;
|
||||
lua_assert(ttype(t1) == ttype(t2));
|
||||
lua_assert(ttisequal(t1, t2));
|
||||
switch (ttype(t1)) {
|
||||
case LUA_TNIL: return 1;
|
||||
case LUA_TNUMBER: return luai_numeq(nvalue(t1), nvalue(t2));
|
||||
|
5
lvm.h
5
lvm.h
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lvm.h,v 2.13 2009/11/19 19:04:58 roberto Exp roberto $
|
||||
** $Id: lvm.h,v 2.14 2009/12/17 16:20:01 roberto Exp roberto $
|
||||
** Lua virtual machine
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -17,8 +17,7 @@
|
||||
|
||||
#define tonumber(o,n) (ttisnumber(o) || (((o) = luaV_tonumber(o,n)) != NULL))
|
||||
|
||||
#define equalobj(L,o1,o2) \
|
||||
(ttype(o1) == ttype(o2) && luaV_equalval_(L, o1, o2))
|
||||
#define equalobj(L,o1,o2) (ttisequal(o1, o2) && luaV_equalval_(L, o1, o2))
|
||||
|
||||
|
||||
/* not to called directly */
|
||||
|
Loading…
Reference in New Issue
Block a user