ref: bdf4d3fe2762e73039908cf7504acc0578d0a697
parent: c6eb7461c6f1d7b62a5740b6225f978ae3f4522e
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Wed Jan 22 13:53:12 EST 2025
leafp mask: make it more descriptive
--- a/flisp.h
+++ b/flisp.h
@@ -19,6 +19,9 @@
TAG_CVALUE,
TAG_SYM,
TAG_CONS,
+
+ /* those were set to 7 and 3 strategically on purpose */
+ TAG_NONLEAF_MASK = TAG_CONS & TAG_VECTOR,
};
enum {
@@ -110,7 +113,7 @@
#define iscvalue(x) (tag(x) == TAG_CVALUE)
#define iscprim(x) (tag(x) == TAG_CPRIM)
// doesn't lead to other values
-#define leafp(a) (((a)&3) != 3)
+#define leafp(a) (((a)&TAG_NONLEAF_MASK) != TAG_NONLEAF_MASK)
// allocate n consecutive conses
#define cons_reserve(n) tagptr(alloc_words((n)*2), TAG_CONS)
--
⑨