@matheusbsbs / matheus-bagliano / commits / 2d08e5dd73
Fork 0

tiny optimization to diff-delta

This is my assembly freak side looking at generated code again. And since create_delta() is certainly pretty high on the radar every bits count. In this case shorter code is generated if hash_mask is not copied to a local variable. Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Junio C Hamano <junkio@cox.net>

Nicolas Pitre committed May 2, 2006 at 23:46 UTC 2d08e5dd730680f7f8645a6326ec653435e032df
1 file changed +2 -3
diff-delta.c
+2 -3
@@ -239,7 +239,7 @@ create_delta(const struct delta_index *index,
239 const void *trg_buf, unsigned long trg_size,
240 unsigned long *delta_size, unsigned long max_size)
241 {
242 - unsigned int i, outpos, outsize, hash_mask, val;
242 + unsigned int i, outpos, outsize, val;
243 int inscnt;
244 const unsigned char *ref_data, *ref_top, *data, *top;
245 unsigned char *out;
@@ -275,7 +275,6 @@ create_delta(const struct delta_index *index,
275 ref_top = ref_data + index->src_size;
276 data = trg_buf;
277 top = trg_buf + trg_size;
278 - hash_mask = index->hash_mask;
278
279 outpos++;
280 val = 0;
@@ -290,7 +289,7 @@ create_delta(const struct delta_index *index,
289 struct index_entry *entry;
290 val ^= U[data[-RABIN_WINDOW]];
291 val = ((val << 8) | *data) ^ T[val >> RABIN_SHIFT];
293 - i = val & hash_mask;
292 + i = val & index->hash_mask;
293 for (entry = index->hash[i]; entry; entry = entry->next) {
294 const unsigned char *ref = entry->ptr;
295 const unsigned char *src = data;