summaryrefslogtreecommitdiff
path: root/handy.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2019-03-27 21:09:14 -0600
committerKarl Williamson <khw@cpan.org>2019-03-29 12:00:16 -0600
commit26c1d9d861d5f70afa8cfb94e7f5a9fbe432a70d (patch)
treed4b596a620bebeef2d622c9a98e2e76c910ea28e /handy.h
parentdd0510590a1124f91ef2c615a64cd9bfbb245dd6 (diff)
downloadperl-26c1d9d861d5f70afa8cfb94e7f5a9fbe432a70d.tar.gz
handy.h: Comments, remove extraneous parens
Diffstat (limited to 'handy.h')
-rw-r--r--handy.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/handy.h b/handy.h
index 3ce0b1bca7..e423ee1578 100644
--- a/handy.h
+++ b/handy.h
@@ -1254,6 +1254,8 @@ END_EXTERN_C
&& ((PL_charclass[(U8) (c)] & _CC_mask_A(classnum)) \
== _CC_mask_A(classnum)))
+/* On ASCII platforms certain classes form a single range. It's faster to
+ * special case these. isDIGIT is a single range on all platforms */
# ifdef EBCDIC
# define isALPHA_A(c) _generic_isCC_A(c, _CC_ALPHA)
# define isGRAPH_A(c) _generic_isCC_A(c, _CC_GRAPH)
@@ -1261,8 +1263,9 @@ END_EXTERN_C
# define isPRINT_A(c) _generic_isCC_A(c, _CC_PRINT)
# define isUPPER_A(c) _generic_isCC_A(c, _CC_UPPER)
# else
+ /* By folding the upper and lowercase, we can use a single range */
# define isALPHA_A(c) inRANGE((~('A' ^ 'a') & (c)), 'A', 'Z')
-# define isGRAPH_A(c) inRANGE((c), ' ' + 1, 0x7e)
+# define isGRAPH_A(c) inRANGE(c, ' ' + 1, 0x7e)
# define isLOWER_A(c) inRANGE(c, 'a', 'z')
# define isPRINT_A(c) inRANGE(c, ' ', 0x7e)
# define isUPPER_A(c) inRANGE(c, 'A', 'Z')