Commit c2550609 by Vicent Marti Committed by Andreas Ericsson

Use the first 4 bytes of an OID as hash, instead of full hashing.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
Signed-off-by: Andreas Ericsson <ae@op5.se>
parent 6bb7aa13
...@@ -30,27 +30,7 @@ const float max_load_factor = 0.65; ...@@ -30,27 +30,7 @@ const float max_load_factor = 0.65;
unsigned int git_revpool_table__hash(const git_oid *id) unsigned int git_revpool_table__hash(const git_oid *id)
{ {
const unsigned int m = 0x5bd1e995; return *((unsigned int *)id->id);
const int r = 24;
unsigned int h = 0xA8A3D5;
int i;
for (i = 0; i < GIT_OID_RAWSZ / 4; ++i) {
unsigned int k = ((unsigned int *)id->id)[i];
k *= m;
k ^= k >> r;
k *= m;
h *= m;
h ^= k;
}
h ^= h >> 13;
h *= m;
h ^= h >> 15;
return h;
} }
git_revpool_table *git_revpool_table_create(unsigned int min_size) git_revpool_table *git_revpool_table_create(unsigned int min_size)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment