From: Eric S. Raymond Date: Fri, 12 Sep 2003 10:01:53 +0000 (+0000) Subject: Reduction was broken. X-Git-Tag: 1.4~4 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=085eb4b82d7def6bcff4c127b318151da254131f;p=comparator.git Reduction was broken. --- diff --git a/report.c b/report.c index b4307a2..4d12c5e 100644 --- a/report.c +++ b/report.c @@ -189,16 +189,19 @@ struct match_t *reduce_matches(struct sorthash_t *obarray, int *hashcountp) * * The technique: first mark... */ - if (!HASHCMP(obarray, obarray+1)) + if (HASHCMP(obarray, obarray+1)) obarray[0].hash.start = UNIQUE_FLAG; for (np = obarray+1; np < obarray + hashcount-1; np++) - if (!HASHCMP(np, np-1) && !HASHCMP(np, np+1)) + if (HASHCMP(np, np-1) && HASHCMP(np, np+1)) np->hash.start = UNIQUE_FLAG; - if (!HASHCMP(obarray+hashcount-2, obarray+hashcount-1)) + if (HASHCMP(obarray+hashcount-2, obarray+hashcount-1)) obarray[hashcount-1].hash.start = UNIQUE_FLAG; + for (np = obarray; np < obarray + hashcount; np++) + printf("%d ", np->hash.start); + putchar('\n'); /* ...then sweep. */ for (mp = np = obarray; np < obarray + hashcount; np++) - if (np->hash.start != UNIQUE_FLAG && mp < np) + if (np->hash.start != UNIQUE_FLAG) *mp++ = *np; /* now we get to reduce the memory footprint */ report_time("Compaction reduced %d shreds to %d",