- * if last_i can hint at a better match */
- for (j++; j < s->count && targets[j].t == t; j++) {
- size_t i2 = targets[j].i;
- if (i2 == last_i + 1) {
- if (sum != s->sums[i2].sum1)
- break;
- if (memcmp(sum2,s->sums[i2].sum2,s->s2length) != 0)
- break;
- /* we've found an adjacent match - the RLL coder
- * will be happy */
- i = i2;
- break;
- }
+ * if want_i can hint at a better match. */
+ if (i != want_i && want_i < s->count
+ && sum == s->sums[want_i].sum1
+ && memcmp(sum2, s->sums[want_i].sum2, s->s2length) == 0) {
+ /* we've found an adjacent match - the RLL coder
+ * will be happy */
+ i = want_i;