comparison mercurial/bdiff.c @ 29010:e868d8ee7c8f stable

bdiff: unify duplicate normalize loops We're about to make the while loop check more complicated, so let's simplify first.
author Matt Mackall <mpm@selenic.com>
date Thu, 21 Apr 2016 21:37:13 -0500
parents 66b21ce60a19
children 8bcda4c76820
comparison
equal deleted inserted replaced
29009:c05cc1b95848 29010:e868d8ee7c8f
262 int shift = 0; 262 int shift = 0;
263 263
264 if (!next) 264 if (!next)
265 break; 265 break;
266 266
267 if (curr->a2 == next->a1) 267 if (curr->a2 == next->a1 || curr->b2 == next->b1)
268 while (curr->a2 + shift < an && curr->b2 + shift < bn 268 while (curr->a2 + shift < an && curr->b2 + shift < bn
269 && !cmp(a + curr->a2 + shift, 269 && !cmp(a + curr->a2 + shift,
270 b + curr->b2 + shift)) 270 b + curr->b2 + shift))
271 shift++;
272 else if (curr->b2 == next->b1)
273 while (curr->b2 + shift < bn && curr->a2 + shift < an
274 && !cmp(b + curr->b2 + shift,
275 a + curr->a2 + shift))
276 shift++; 271 shift++;
277 if (!shift) 272 if (!shift)
278 continue; 273 continue;
279 curr->b2 += shift; 274 curr->b2 += shift;
280 next->b1 += shift; 275 next->b1 += shift;