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>
Pierre Habouzit committed
Aug 23, 2006 at 11:17 UTC
b05faa2da9ec24d737bbba47c71e815255f3eaa7
1 file changed
+1
-1
diff-delta.c
+1
-1
@@ -152,7 +152,7 @@ struct delta_index * create_delta_index(const void *buf, unsigned long bufsize)
152
initialization in create_delta(). */
153
entries = (bufsize - 1) / RABIN_WINDOW;
154
hsize = entries / 4;
155
- for (i = 4; (1 << i) < hsize && i < 31; i++);
155
+ for (i = 4; (1u << i) < hsize && i < 31; i++);
156
hsize = 1 << i;
157
hmask = hsize - 1;
158