lua

A copy of the Lua development repository
Log | Files | Refs | README

commit 724012d3d07f43f03451bb05d2bd9f55dff1d116
parent 664bda02ba4bd167728a2acbe658cc4a9dd9b0b5
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Thu, 16 Jan 2025 16:11:22 -0300

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:
Mlapi.c | 4+---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/lapi.c b/lapi.c @@ -40,10 +40,8 @@ const char lua_ident[] = /* ** Test for a valid index (one that is not the 'nilvalue'). -** '!ttisnil(o)' implies 'o != &G(L)->nilvalue', so it is not needed. -** However, it covers the most common cases in a faster way. */ -#define isvalid(L, o) (!ttisnil(o) || o != &G(L)->nilvalue) +#define isvalid(L, o) ((o) != &G(L)->nilvalue) /* test for pseudo index */