This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
handy.h: Make macro more efficient on EBCDIC
authorKarl Williamson <public@khwilliamson.com>
Wed, 26 Jun 2013 21:49:13 +0000 (15:49 -0600)
committerKarl Williamson <khw@cpan.org>
Sat, 31 May 2014 16:14:05 +0000 (10:14 -0600)
The comments say it all

handy.h

diff --git a/handy.h b/handy.h
index e4e5292..44dc64d 100644 (file)
--- a/handy.h
+++ b/handy.h
@@ -1550,7 +1550,15 @@ EXTCONST U32 PL_charclass[];
                                                utf8, the non-utf8 macro works
                                              */
 #define isBLANK_utf8(p)         _generic_func_utf8(_CC_BLANK, is_HORIZWS_high, p)
-#define isCNTRL_utf8(p)         _generic_utf8(_CC_CNTRL, p, 0)
+
+#ifdef EBCDIC
+    /* Because all controls are UTF-8 invariants in EBCDIC, we can use this
+     * more efficient macro instead of the more general one */
+#   define isCNTRL_utf8(p)      isCNTRL_L1(p)
+#else
+#   define isCNTRL_utf8(p)      _generic_utf8(_CC_CNTRL, p, 0)
+#endif
+
 #define isDIGIT_utf8(p)         _generic_utf8_no_upper_latin1(_CC_DIGIT, p,   \
                                                   _is_utf8_FOO(_CC_DIGIT, p))
 #define isGRAPH_utf8(p)         _generic_swash_utf8(_CC_GRAPH, p)