From: Nicolas Pitre Date: Fri, 10 Feb 2006 18:42:05 +0000 (-0500) Subject: delta micro optimization X-Git-Tag: v1.2.0~24 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=39556fbdadaacf67330bc1464e0172468e9c3a5e;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/delta.h b/delta.h index 31d1820f8..a15350dab 100644 --- a/delta.h +++ b/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) { 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; }