From 7c3cb71fa48fbe84d9d9c664eb646446fb80898b Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 7 Aug 2020 11:21:44 -0300 Subject: Free bit 7 of GC 'marked' field Tables were using this bit to indicate their array sizes were real ('isrealasize'), but this bit can be useful for tests. Instead, they can use bit 7 of their 'flag' field for that purpose. (There are only six fast-access metamethods.) This 'flag' field only exists in tables, so this use does not affect other types. --- ltm.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'ltm.h') diff --git a/ltm.h b/ltm.h index 99b545e7..73b833c6 100644 --- a/ltm.h +++ b/ltm.h @@ -45,6 +45,15 @@ typedef enum { } TMS; +/* +** Mask with 1 in all fast-access methods. A 1 in any of these bits +** in the flag of a (meta)table means the metatable does not have the +** corresponding metamethod field. (Bit 7 of the flag is used for +** 'isrealasize'.) +*/ +#define maskflags (~(~0u << (TM_EQ + 1))) + + /* ** Test whether there is no tagmethod. ** (Because tagmethods use raw accesses, the result may be an "empty" nil.) -- cgit v1.2.3-55-g6feb