equal
deleted
inserted
replaced
149 worst-case performance. by choosing a window at the end, we |
149 worst-case performance. by choosing a window at the end, we |
150 reduce skipping overhead on the b chains. */ |
150 reduce skipping overhead on the b chains. */ |
151 if (a2 - a1 > 30000) |
151 if (a2 - a1 > 30000) |
152 a1 = a2 - 30000; |
152 a1 = a2 - 30000; |
153 |
153 |
154 half = (a1 + a2) / 2; |
154 half = (a1 + a2 - 1) / 2; |
155 |
155 |
156 for (i = a1; i < a2; i++) { |
156 for (i = a1; i < a2; i++) { |
157 /* skip all lines in b after the current block */ |
157 /* skip all lines in b after the current block */ |
158 for (j = a[i].n; j >= b2; j = b[j].n) |
158 for (j = a[i].n; j >= b2; j = b[j].n) |
159 ; |
159 ; |
175 pos[j].pos = i; |
175 pos[j].pos = i; |
176 pos[j].len = k; |
176 pos[j].len = k; |
177 |
177 |
178 /* best match so far? we prefer matches closer |
178 /* best match so far? we prefer matches closer |
179 to the middle to balance recursion */ |
179 to the middle to balance recursion */ |
180 if (k > mk || (k == mk && (i <= mi || i < half))) { |
180 if (k > mk || (k == mk && (i <= mi || i <= half))) { |
181 mi = i; |
181 mi = i; |
182 mj = j; |
182 mj = j; |
183 mk = k; |
183 mk = k; |
184 } |
184 } |
185 } |
185 } |