From cdcb86a4daaa4b94ca2634a010e2f726b7d48807 Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Wed, 26 Feb 2003 22:03:55 +0000 Subject: make it faster --- ext/dba/libcdb/cdb.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/ext/dba/libcdb/cdb.c b/ext/dba/libcdb/cdb.c index da3de2ff34..16aaca037a 100644 --- a/ext/dba/libcdb/cdb.c +++ b/ext/dba/libcdb/cdb.c @@ -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; } -- cgit v1.2.1