From: Avery Pennarun Date: Tue, 29 Dec 2009 18:07:22 +0000 (-0500) Subject: Make split condition depend on ~0, not 0. X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=55944d161c80af45ad60e8fe46a02e09501ccee2;p=packages%2Fb%2Fbup.git Make split condition depend on ~0, not 0. Otherwise we could end up splitting on one-byte blocks, which is pretty dumb. --- diff --git a/hashsplit.c b/hashsplit.c index 3b764f2..60ba302 100644 --- a/hashsplit.c +++ b/hashsplit.c @@ -70,7 +70,7 @@ int main() i = (i + 1) % WINDOWSIZE; count++; - if ((sum & (BLOBSIZE-1)) == 0) + if ((sum & (BLOBSIZE-1)) == ((~0) & (BLOBSIZE-1))) { fprintf(stderr, "SPLIT @ %-8d size=%-8d (%d/%d)\n", count, count - last_count, BLOBSIZE, WINDOWSIZE);