Skip to content

Commit cdcb86a

Browse files
committed
make it faster
1 parent 6fd9c32 commit cdcb86a

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

ext/dba/libcdb/cdb.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,23 +64,14 @@ static int cdb_match(struct cdb *c, char *key, unsigned int len, uint32 pos TSRM
6464
}
6565
/* }}} */
6666

67-
/* {{{ cdb_hashadd */
68-
static uint32 cdb_hashadd(uint32 h, unsigned char c)
69-
{
70-
h += (h << 5);
71-
return h ^ c;
72-
}
73-
/* }}} */
74-
7567
/* {{{ cdb_hash */
7668
uint32 cdb_hash(char *buf, unsigned int len)
7769
{
7870
uint32 h;
7971

8072
h = CDB_HASHSTART;
81-
while (len) {
82-
h = cdb_hashadd(h, *buf++);
83-
--len;
73+
while (len--) {
74+
h = ( h + (h << 5)) ^ (*buf++);
8475
}
8576
return h;
8677
}

0 commit comments

Comments
 (0)