summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2010-05-28 01:50:59 +0200
committerAndreas Ericsson <ae@op5.se>2010-06-02 10:32:07 +0200
commitc2550609e37e0778814d328c47eb84a7ede6931f (patch)
treeab42d1514cd6b1007d794885dbcc0e7918e91b1f /src
parent6bb7aa1318f7f31a346c71ef81d2b33c6fd41600 (diff)
downloadlibgit2-c2550609e37e0778814d328c47eb84a7ede6931f.tar.gz
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>
Diffstat (limited to 'src')
-rw-r--r--src/revobject.c22
1 files changed, 1 insertions, 21 deletions
diff --git a/src/revobject.c b/src/revobject.c
index a0d9ac96c..182f2b393 100644
--- a/src/revobject.c
+++ b/src/revobject.c
@@ -30,27 +30,7 @@ const float max_load_factor = 0.65;
unsigned int git_revpool_table__hash(const git_oid *id)
{
- const unsigned int m = 0x5bd1e995;
- 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;
+ return *((unsigned int *)id->id);
}
git_revpool_table *git_revpool_table_create(unsigned int min_size)