Fix a comparison bug in diff-delta.c

(1 << i) < hspace is compared in the `int` space rather that in the
unsigned one.  the result will be wrong if hspace is between 0x40000000
and 0x80000000.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Pierre Habouzit 2006-08-23 11:17:55 +02:00 committed by Junio C Hamano
parent 68d42c41ef
commit b05faa2da9

View File

@ -152,7 +152,7 @@ struct delta_index * create_delta_index(const void *buf, unsigned long bufsize)
initialization in create_delta(). */ initialization in create_delta(). */
entries = (bufsize - 1) / RABIN_WINDOW; entries = (bufsize - 1) / RABIN_WINDOW;
hsize = entries / 4; hsize = entries / 4;
for (i = 4; (1 << i) < hsize && i < 31; i++); for (i = 4; (1u << i) < hsize && i < 31; i++);
hsize = 1 << i; hsize = 1 << i;
hmask = hsize - 1; hmask = hsize - 1;