X-Git-Url: http://lists.indexdata.com/cgi-bin?a=blobdiff_plain;f=src%2Freclists.c;h=3e3100c8be1dfdfdb12e79738105256e09ca45c3;hb=6639c716d02ad6117ae6053ca18160dbb21a404a;hp=7d92643d1a6ddd960444dc85dad24ac28ca99977;hpb=32946760b9c974f112017d79ab756cf1dd85ca6b;p=pazpar2-moved-to-github.git diff --git a/src/reclists.c b/src/reclists.c index 7d92643..3e3100c 100644 --- a/src/reclists.c +++ b/src/reclists.c @@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "pazpar2.h" #include "reclists.h" -#include "parameters.h" +#include "jenkins_hash.h" static struct reclist_sortparms *qsort_sortparms = 0; /* thread pr */ @@ -232,23 +232,6 @@ void reclist_rewind(struct reclist *l) l->pointer = 0; } -// Jenkins one-at-a-time hash (from wikipedia) -static unsigned int hash(const unsigned char *key) -{ - unsigned int hash = 0; - - while (*key) - { - hash += *(key++); - hash += (hash << 10); - hash ^= (hash >> 6); - } - hash += (hash << 3); - hash ^= (hash >> 11); - hash += (hash << 15); - return hash; -} - struct reclist *reclist_create(NMEM nmem, int numrecs) { int hashsize = 1; @@ -288,7 +271,7 @@ struct record_cluster *reclist_insert( struct reclist *l, assert(merge_key); assert(total); - bucket = hash((unsigned char*) merge_key) & l->hashmask; + bucket = jenkins_hash((unsigned char*) merge_key) & l->hashmask; for (p = &l->hashtable[bucket]; *p; p = &(*p)->next) {