summaryrefslogtreecommitdiff
path: root/utf8.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2021-05-16 16:07:11 -0600
committerKarl Williamson <khw@cpan.org>2021-05-28 15:23:57 -0600
commitaacc849b92da13c1abc5b61e3d3c58d7016e3caf (patch)
tree7cbd3a45ef15de3c3be106ace5197b654a2698d2 /utf8.h
parent573d6c09680ce3dcfe8901028ea1f2ff44212ebe (diff)
downloadperl-aacc849b92da13c1abc5b61e3d3c58d7016e3caf.tar.gz
utf8.h: Refactor UNICODE_IS_NONCHAR()
This adds branch prediction and re-orders so that an unlikely to succeed test is done before the likely to succeed one, so that the latter usually doesn't need to be executed. Since both conditions must succeed for the entire expression to succeed, this doesn't change what the whole expresson matches. s# Please enter the commit message for your changes. Lines starting
Diffstat (limited to 'utf8.h')
-rw-r--r--utf8.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/utf8.h b/utf8.h
index 3bec01989f..20b845734c 100644
--- a/utf8.h
+++ b/utf8.h
@@ -970,9 +970,9 @@ Evaluates to 0xFFFD, the code point of the Unicode REPLACEMENT CHARACTER
UNLIKELY(((UV) (uv) & 0xFFFE) == 0xFFFE)
#define UNICODE_IS_NONCHAR(uv) \
- ( UNICODE_IS_32_CONTIGUOUS_NONCHARS(uv) \
- || ( LIKELY( ! UNICODE_IS_SUPER(uv)) \
- && UNICODE_IS_END_PLANE_NONCHAR_GIVEN_NOT_SUPER(uv)))
+ ( UNLIKELY(UNICODE_IS_32_CONTIGUOUS_NONCHARS(uv)) \
+ || ( UNLIKELY(UNICODE_IS_END_PLANE_NONCHAR_GIVEN_NOT_SUPER(uv)) \
+ && LIKELY(! UNICODE_IS_SUPER(uv))))
#define UNICODE_IS_SUPER(uv) UNLIKELY((UV) (uv) > PERL_UNICODE_MAX)