summaryrefslogtreecommitdiff
path: root/utf8.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2014-05-06 13:18:28 -0600
committerKarl Williamson <khw@cpan.org>2014-05-31 11:56:56 -0600
commitdd9bc2b0af8e838ed989897601a0ee36eeed092f (patch)
tree3959f11992c39bfb524821df995928ec1e1b3ed2 /utf8.h
parentf2645549e6a4bfca055b5fd1932da462df424921 (diff)
downloadperl-dd9bc2b0af8e838ed989897601a0ee36eeed092f.tar.gz
Add some (UN)?LIKELY() to UTF8 handling
It's very rare actually for code to be presented with malformed UTF-8, so give the compiler a hint about the likely branches.
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 74e7d48e59..52671ebb9d 100644
--- a/utf8.h
+++ b/utf8.h
@@ -639,13 +639,13 @@ machines) is a valid UTF-8 character.
=cut
*/
-#define isUTF8_CHAR(s, e) (((e) <= (s)) \
+#define isUTF8_CHAR(s, e) (UNLIKELY((e) <= (s)) \
? 0 \
: (UTF8_IS_INVARIANT(*s)) \
? 1 \
- : (((e) - (s)) < UTF8SKIP(s)) \
+ : UNLIKELY(((e) - (s)) < UTF8SKIP(s)) \
? 0 \
- : (IS_UTF8_CHAR_FAST(UTF8SKIP(s))) \
+ : LIKELY(IS_UTF8_CHAR_FAST(UTF8SKIP(s))) \
? is_UTF8_CHAR_utf8_no_length_checks(s) \
: _is_utf8_char_slow(s, e))