Skip to content

Commit 39556fb

Browse files
Nicolas PitreJunio C Hamano
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e7ad4a9 commit 39556fb

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

delta.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ extern void *patch_delta(void *src_buf, unsigned long src_size,
1919
static inline unsigned long get_delta_hdr_size(const unsigned char **datap)
2020
{
2121
const unsigned char *data = *datap;
22-
unsigned char cmd = *data++;
23-
unsigned long size = cmd & ~0x80;
24-
int i = 7;
25-
while (cmd & 0x80) {
22+
unsigned char cmd;
23+
unsigned long size = 0;
24+
int i = 0;
25+
do {
2626
cmd = *data++;
2727
size |= (cmd & ~0x80) << i;
2828
i += 7;
29-
}
29+
} while (cmd & 0x80);
3030
*datap = data;
3131
return size;
3232
}

0 commit comments

Comments
 (0)