aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-01-16 16:11:49 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-01-16 16:11:49 -0300
commit724012d3d07f43f03451bb05d2bd9f55dff1d116 (patch)
tree697b1bde058acf4c94a29c3520d8715560bc412a
parent664bda02ba4bd167728a2acbe658cc4a9dd9b0b5 (diff)
downloadlua-724012d3d07f43f03451bb05d2bd9f55dff1d116.tar.gz
lua-724012d3d07f43f03451bb05d2bd9f55dff1d116.tar.bz2
lua-724012d3d07f43f03451bb05d2bd9f55dff1d116.zip
Small change in macro 'isvalid'
The "faster way" to check whether a value is not 'nilvalue' is not faster. (Both forms entail one memory access.)
-rw-r--r--lapi.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/lapi.c b/lapi.c
index 4411cb29..cf73324b 100644
--- a/lapi.c
+++ b/lapi.c
@@ -40,10 +40,8 @@ const char lua_ident[] =
40 40
41/* 41/*
42** Test for a valid index (one that is not the 'nilvalue'). 42** Test for a valid index (one that is not the 'nilvalue').
43** '!ttisnil(o)' implies 'o != &G(L)->nilvalue', so it is not needed.
44** However, it covers the most common cases in a faster way.
45*/ 43*/
46#define isvalid(L, o) (!ttisnil(o) || o != &G(L)->nilvalue) 44#define isvalid(L, o) ((o) != &G(L)->nilvalue)
47 45
48 46
49/* test for pseudo index */ 47/* test for pseudo index */