diff options
author | Nicolas Pitre <nico@cam.org> | 2007-04-09 01:06:29 -0400 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2007-04-10 12:48:14 -0700 |
commit | 8723f216263ba4a0f06be7b93fada863c0931e09 (patch) | |
tree | 6d357724c891ce009a8c7ae1a0a4083bc39ff1f5 /builtin-pack-objects.c | |
parent | 57059091fad25427bce9b3d47e073ce0518d164b (diff) | |
download | git-8723f216263ba4a0f06be7b93fada863c0931e09.tar.gz |
make overflow test on delta base offset work regardless of variable size
This patch introduces the MSB() macro to obtain the desired number of
most significant bits from a given variable independently of the variable
type.
It is then used to better implement the overflow test on the OBJ_OFS_DELTA
base offset variable with the property of always working correctly
regardless of the type/size of that variable.
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-pack-objects.c')
-rw-r--r-- | builtin-pack-objects.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c index 6bff17b130..ee607a0d2c 100644 --- a/builtin-pack-objects.c +++ b/builtin-pack-objects.c @@ -1014,7 +1014,7 @@ static void check_object(struct object_entry *entry) ofs = c & 127; while (c & 128) { ofs += 1; - if (!ofs || ofs & ~(~0UL >> 7)) + if (!ofs || MSB(ofs, 7)) die("delta base offset overflow in pack for %s", sha1_to_hex(entry->sha1)); c = buf[used_0++]; |