aboutsummaryrefslogtreecommitdiff
path: root/diff-delta.c
diff options
context:
space:
mode:
authorNicolas Pitre <nico@cam.org>2006-05-02 23:46:51 -0400
committerJunio C Hamano <junkio@cox.net>2006-05-02 21:32:32 -0700
commit2d08e5dd730680f7f8645a6326ec653435e032df (patch)
treec7ef4bbad6607e767d60b3670c772aee8f056605 /diff-delta.c
parent3dc5a9e4cdcc7124c665a050547d1285d86a421f (diff)
downloadgit-2d08e5dd730680f7f8645a6326ec653435e032df.tar.gz
git-2d08e5dd730680f7f8645a6326ec653435e032df.tar.xz
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>
Diffstat (limited to 'diff-delta.c')
-rw-r--r--diff-delta.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/diff-delta.c b/diff-delta.c
index 35e517d2d..45df786b0 100644
--- a/diff-delta.c
+++ b/diff-delta.c
@@ -239,7 +239,7 @@ create_delta(const struct delta_index *index,
const void *trg_buf, unsigned long trg_size,
unsigned long *delta_size, unsigned long max_size)
{
- unsigned int i, outpos, outsize, hash_mask, val;
+ unsigned int i, outpos, outsize, val;
int inscnt;
const unsigned char *ref_data, *ref_top, *data, *top;
unsigned char *out;
@@ -275,7 +275,6 @@ create_delta(const struct delta_index *index,
ref_top = ref_data + index->src_size;
data = trg_buf;
top = trg_buf + trg_size;
- hash_mask = index->hash_mask;
outpos++;
val = 0;
@@ -290,7 +289,7 @@ create_delta(const struct delta_index *index,
struct index_entry *entry;
val ^= U[data[-RABIN_WINDOW]];
val = ((val << 8) | *data) ^ T[val >> RABIN_SHIFT];
- i = val & hash_mask;
+ i = val & index->hash_mask;
for (entry = index->hash[i]; entry; entry = entry->next) {
const unsigned char *ref = entry->ptr;
const unsigned char *src = data;