diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-01-16 16:11:49 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-01-16 16:11:49 -0300 |
commit | 724012d3d07f43f03451bb05d2bd9f55dff1d116 (patch) | |
tree | 697b1bde058acf4c94a29c3520d8715560bc412a /lapi.c | |
parent | 664bda02ba4bd167728a2acbe658cc4a9dd9b0b5 (diff) | |
download | lua-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.)
Diffstat (limited to 'lapi.c')
-rw-r--r-- | lapi.c | 4 |
1 files changed, 1 insertions, 3 deletions
@@ -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 */ |