diff options
author | Karl Williamson <public@khwilliamson.com> | 2013-06-26 15:30:59 -0600 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2013-08-29 09:56:09 -0600 |
commit | d943212517d35e9f03278a2209388b93f634664a (patch) | |
tree | c1ef789af97ff99a511ae5c842604a245f8fc611 /utf8.c | |
parent | a3481822e07c32c1f394cd35adc5080a45f628d7 (diff) | |
download | perl-d943212517d35e9f03278a2209388b93f634664a.tar.gz |
utf8.c: Move some code around for speed
This is a micro optimization. We now check for a common case and return
if found, before checking for a relatively uncommon case.
Diffstat (limited to 'utf8.c')
-rw-r--r-- | utf8.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -100,6 +100,11 @@ Perl_uvoffuni_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags) { PERL_ARGS_ASSERT_UVOFFUNI_TO_UTF8_FLAGS; + if (UNI_IS_INVARIANT(uv)) { + *d++ = (U8) LATIN1_TO_NATIVE(uv); + return d; + } + /* The first problematic code point is the first surrogate */ if (uv >= UNICODE_SURROGATE_FIRST && ckWARN4_d(WARN_UTF8, WARN_SURROGATE, WARN_NON_UNICODE, WARN_NONCHAR)) @@ -137,12 +142,9 @@ Perl_uvoffuni_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags) } } } - if (UNI_IS_INVARIANT(uv)) { - *d++ = (U8) LATIN1_TO_NATIVE(uv); - return d; - } + #if defined(EBCDIC) - else { + { STRLEN len = OFFUNISKIP(uv); U8 *p = d+len-1; while (p > d) { |