Browse Source

Changed definition of macro 'l_isfalse'

The old definition did one test for nil, but three tests for the all
too common booleans (and two tests for other values); this definition
does two tests for all values.
Roberto Ierusalimschy 5 years ago
parent
commit
b8cdea0190
1 changed files with 1 additions and 1 deletions
  1. 1 1
      lobject.h

+ 1 - 1
lobject.h

@@ -216,7 +216,7 @@ typedef StackValue *StkId;
 
 #define bvalueraw(v)	((v).b)
 
-#define l_isfalse(o)	(ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0))
+#define l_isfalse(o)	(ttisboolean(o) ? bvalue(o) == 0 : ttisnil(o))
 
 #define setbvalue(obj,x) \
   { TValue *io=(obj); val_(io).b=(x); settt_(io, LUA_TBOOLEAN); }