make it faster

This commit is contained in:
Marcus Boerger 2003-02-26 22:03:55 +00:00
parent 6fd9c32346
commit cdcb86a4da

View File

@ -64,23 +64,14 @@ static int cdb_match(struct cdb *c, char *key, unsigned int len, uint32 pos TSRM
}
/* }}} */
/* {{{ cdb_hashadd */
static uint32 cdb_hashadd(uint32 h, unsigned char c)
{
h += (h << 5);
return h ^ c;
}
/* }}} */
/* {{{ cdb_hash */
uint32 cdb_hash(char *buf, unsigned int len)
{
uint32 h;
h = CDB_HASHSTART;
while (len) {
h = cdb_hashadd(h, *buf++);
--len;
while (len--) {
h = ( h + (h << 5)) ^ (*buf++);
}
return h;
}