From: Nicholas Clark Date: Thu, 23 Mar 2006 14:09:33 +0000 (+0000) Subject: Make S_sv_pos_u2b_cached use both cache pairs. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=dd7c5fd3a00e036412095647a0fc720a41dd4fea;p=p5sagit%2Fp5-mst-13.2.git Make S_sv_pos_u2b_cached use both cache pairs. p4raw-id: //depot/perl@27585 --- diff --git a/sv.c b/sv.c index 62f6107..fbc9c9f 100644 --- a/sv.c +++ b/sv.c @@ -5425,12 +5425,26 @@ S_sv_pos_u2b_cached(pTHX_ SV *sv, MAGIC **mgp, const U8 *const start, + S_sv_pos_u2b_forwards(aTHX_ start + boffset0, send, uoffset - uoffset0); } - } else { + } + else if (cache[2] < uoffset) { + /* We're between the two cache entries. */ + if (cache[2] > uoffset0) { + /* and the cache knows more than the passed in pair */ + uoffset0 = cache[2]; + boffset0 = cache[3]; + } + boffset = boffset0 + S_sv_pos_u2b_midway(aTHX_ start + boffset0, start + cache[1], uoffset - uoffset0, cache[0] - uoffset0); + } else { + boffset = boffset0 + + S_sv_pos_u2b_midway(aTHX_ start + boffset0, + start + cache[3], + uoffset - uoffset0, + cache[2] - uoffset0); } found = TRUE; }