diff options
author | Daniel Dragan <bulk88@hotmail.com> | 2014-09-18 20:32:20 -0400 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2014-09-20 07:43:23 -0700 |
commit | 73ecc8cb698116fbf9083ebd625b85eff621e01c (patch) | |
tree | 204246e654526c5634a843e0abea7668c97e3ee0 /sv.c | |
parent | 84d03adf4b941899c10e7644b4dcc13dfd13a7ee (diff) | |
download | perl-73ecc8cb698116fbf9083ebd625b85eff621e01c.tar.gz |
factor out FP heavy code in utf8_mg_pos_cache_update
Visual C 2003 and 6 couldn't factor this FP math heavy expression out
with -O1, and it appeared twice in machine code, so do it by hand.
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 55 |
1 files changed, 26 insertions, 29 deletions
@@ -7403,38 +7403,35 @@ S_utf8_mg_pos_cache_update(pTHX_ SV *const sv, MAGIC **const mgp, const STRLEN b cache[1] = byte; } } - else if (byte > cache[3]) { - /* New position is between the existing pair of pairs. */ - const float keep_earlier - = THREEWAY_SQUARE(0, cache[3], byte, blen); - const float keep_later - = THREEWAY_SQUARE(0, byte, cache[1], blen); - - if (keep_later < keep_earlier) { - cache[2] = utf8; - cache[3] = byte; - } - else { - cache[0] = utf8; - cache[1] = byte; - } - } else { - /* New position is before the existing pair of pairs. */ - const float keep_earlier - = THREEWAY_SQUARE(0, byte, cache[3], blen); - const float keep_later - = THREEWAY_SQUARE(0, byte, cache[1], blen); - - if (keep_later < keep_earlier) { - cache[2] = utf8; - cache[3] = byte; + const float keep_later = THREEWAY_SQUARE(0, byte, cache[1], blen); + if (byte > cache[3]) { + /* New position is between the existing pair of pairs. */ + const float keep_earlier + = THREEWAY_SQUARE(0, cache[3], byte, blen); + if (keep_later < keep_earlier) { + cache[2] = utf8; + cache[3] = byte; + } + else { + cache[0] = utf8; + cache[1] = byte; + } } else { - cache[0] = cache[2]; - cache[1] = cache[3]; - cache[2] = utf8; - cache[3] = byte; + /* New position is before the existing pair of pairs. */ + const float keep_earlier + = THREEWAY_SQUARE(0, byte, cache[3], blen); + if (keep_later < keep_earlier) { + cache[2] = utf8; + cache[3] = byte; + } + else { + cache[0] = cache[2]; + cache[1] = cache[3]; + cache[2] = utf8; + cache[3] = byte; + } } } } |