Browse Source

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>
maint
Nicolas Pitre 19 years ago committed by Junio C Hamano
parent
commit
39556fbdad
  1. 10
      delta.h

10
delta.h

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

Loading…
Cancel
Save