summaryrefslogtreecommitdiff
path: root/ext/dba/libcdb
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2003-02-26 22:03:55 +0000
committerMarcus Boerger <helly@php.net>2003-02-26 22:03:55 +0000
commitcdcb86a4daaa4b94ca2634a010e2f726b7d48807 (patch)
treeff818a84608f622f9677f256b18c76dcebfacb30 /ext/dba/libcdb
parent6fd9c32346b7a35dbb237c0dcd775265c384b245 (diff)
downloadphp-git-cdcb86a4daaa4b94ca2634a010e2f726b7d48807.tar.gz
make it faster
Diffstat (limited to 'ext/dba/libcdb')
-rw-r--r--ext/dba/libcdb/cdb.c13
1 files 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;
}