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:
parent
e7ad4a9c3c
commit
39556fbdad
10
delta.h
10
delta.h
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user