git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] delta micro optimization

From
Nicolas Pitre <nico@cam.org>
Date
Feb 10, 2006, 18:42 UTC
Message-ID
<Pine.LNX.4.64.0602101335160.5397@localhost.localdomain>

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>
---
diff --git a/delta.h b/delta.h
index 31d1820..a15350d 100644
--- a/delta.h
+++ b/delta.h
@@ -19,14 +19,14 @@ extern void *patch_delta(void *src_buf, 
 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;
 }
Next: Junio C Hamano
Message 1 of 3 in “delta micro optimization”
  1. delta micro optimizationNicolas Pitre, Feb 10, 2006
  2. Junio C HamanoFeb 10, 2006
  3. Nicolas PitreFeb 10, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.