summaryrefslogtreecommitdiff
path: root/regnodes.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2020-04-03 10:22:19 -0600
committerKarl Williamson <khw@cpan.org>2020-10-16 07:01:41 -0600
commit938090acbdbd9475a044786f75bbbcf4e64d3b49 (patch)
tree17d61f9869ae4c2cab81d4ae0dfe7d7292bfecd1 /regnodes.h
parenta234542cd411731277682fb13ab4cf77e841b134 (diff)
downloadperl-938090acbdbd9475a044786f75bbbcf4e64d3b49.tar.gz
regnodes.h: Add two convenience bit masks
These categorize the many types of EXACT nodes, so that code can refer to a particular subset of such nodes without having to list all of them out. This simplifies some 'if' statements, and makes updating things easier.
Diffstat (limited to 'regnodes.h')
-rw-r--r--regnodes.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/regnodes.h b/regnodes.h
index 3e5723d1ee..2719b8219a 100644
--- a/regnodes.h
+++ b/regnodes.h
@@ -1753,4 +1753,18 @@ EXTCONST U8 PL_simple_bitmask[] = {
};
#endif /* DOINIT */
+/* Is 'op', known to be of type EXACT, folding? */
+#define isEXACTFish(op) (__ASSERT_(PL_regkind[op] == EXACT) (PL_EXACTFish_bitmask & (1U << (op - EXACT))))
+
+/* Do only UTF-8 target strings match 'op', known to be of type EXACT? */
+#define isEXACT_REQ8(op) (__ASSERT_(PL_regkind[op] == EXACT) (PL_EXACT_REQ8_bitmask & (1U << (op - EXACT))))
+
+#ifndef DOINIT
+EXTCONST U32 PL_EXACTFish_bitmask;
+EXTCONST U32 PL_EXACT_REQ8_bitmask;
+#else
+EXTCONST U32 PL_EXACTFish_bitmask = 0x33F8;
+EXTCONST U32 PL_EXACT_REQ8_bitmask = 0x1E00;
+#endif /* DOINIT */
+
/* ex: set ro: */