diff options
author | Karl Williamson <khw@cpan.org> | 2014-05-06 13:18:28 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2014-05-31 11:56:56 -0600 |
commit | dd9bc2b0af8e838ed989897601a0ee36eeed092f (patch) | |
tree | 3959f11992c39bfb524821df995928ec1e1b3ed2 /utf8.h | |
parent | f2645549e6a4bfca055b5fd1932da462df424921 (diff) | |
download | perl-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.h | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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)) |