- sum = (s1 & 0xffff) | (s2 << 16);
- tag_hits++;
- for (; j<s->count && targets[j].t == t; j++) {
- int i = targets[j].i;
-
- if (sum != s->sums[i].sum1) continue;
-
- if (verbose > 3)
- rprintf(FINFO,"potential match at %d target=%d %d sum=%08x\n",
- (int)offset,j,i,sum);
-
+ if (tablesize == TRADITIONAL_TABLESIZE) {
+ if ((i = hash_table[SUM2HASH2(s1,s2)]) < 0)
+ goto null_hash;
+ sum = (s1 & 0xffff) | (s2 << 16);
+ } else {
+ sum = (s1 & 0xffff) | (s2 << 16);
+ if ((i = hash_table[BIG_SUM2HASH(sum)]) < 0)
+ goto null_hash;
+ }
+
+ hash_hits++;
+ do {
+ int32 l;
+
+ if (sum != s->sums[i].sum1)
+ continue;
+
+ /* also make sure the two blocks are the same length */
+ l = (int32)MIN((OFF_T)s->blength, len-offset);
+ if (l != s->sums[i].len)
+ continue;
+
+ /* in-place: ensure chunk's offset is either >= our
+ * offset or that the data didn't move. */
+ if (updating_basis_file && s->sums[i].offset < offset
+ && !(s->sums[i].flags & SUMFLG_SAME_OFFSET))
+ continue;
+
+ if (DEBUG_GTE(DELTASUM, 3)) {
+ rprintf(FINFO,
+ "potential match at %s i=%ld sum=%08x\n",
+ big_num(offset), (long)i, sum);
+ }
+