delta micro optimization

My kernel work habit made me look at the generated assembly for the
delta code, and one obvious albeit small improvement is this patch.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Nicolas Pitre 2006-02-10 13:42:05 -05:00 committed by Junio C Hamano
parent e7ad4a9c3c
commit 39556fbdad

10
delta.h
View File

@ -19,14 +19,14 @@ extern void *patch_delta(void *src_buf, unsigned long src_size,
static inline unsigned long get_delta_hdr_size(const unsigned char **datap) static inline unsigned long get_delta_hdr_size(const unsigned char **datap)
{ {
const unsigned char *data = *datap; const unsigned char *data = *datap;
unsigned char cmd = *data++; unsigned char cmd;
unsigned long size = cmd & ~0x80; unsigned long size = 0;
int i = 7; int i = 0;
while (cmd & 0x80) { do {
cmd = *data++; cmd = *data++;
size |= (cmd & ~0x80) << i; size |= (cmd & ~0x80) << i;
i += 7; i += 7;
} } while (cmd & 0x80);
*datap = data; *datap = data;
return size; return size;
} }