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>
Nicolas Pitre committed
Feb 10, 2006 at 13:42 UTC
39556fbdadaacf67330bc1464e0172468e9c3a5e
1 file changed
+5
-5
delta.h
+5
-5
@@ -19,14 +19,14 @@ extern void *patch_delta(void *src_buf, unsigned long src_size,
19
static inline unsigned long get_delta_hdr_size(const unsigned char **datap)
20
{
21
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 {
26
cmd = *data++;
27
size |= (cmd & ~0x80) << i;
28
i += 7;
29
- }
29
+ } while (cmd & 0x80);
30
*datap = data;
31
return size;
32
}