helly Wed Feb 26 17:03:55 2003 EDT Modified files: /php4/ext/dba/libcdb cdb.c Log: make it faster Index: php4/ext/dba/libcdb/cdb.c diff -u php4/ext/dba/libcdb/cdb.c:1.6 php4/ext/dba/libcdb/cdb.c:1.7 --- php4/ext/dba/libcdb/cdb.c:1.6 Tue Dec 31 11:06:25 2002 +++ php4/ext/dba/libcdb/cdb.c Wed Feb 26 17:03:55 2003 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: cdb.c,v 1.6 2002/12/31 16:06:25 sebastian Exp $ */ +/* $Id: cdb.c,v 1.7 2003/02/26 22:03:55 helly Exp $ */ /* incorporated from D.J.Bernstein's cdb-0.75 (http://cr.yp.to/cdb.html)*/ @@ -64,23 +64,14 @@ } /* }}} */ -/* {{{ 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; } @@ -197,6 +188,6 @@ /* {{{ cdb_version */ char *cdb_version() { - return "0.75, $Revision: 1.6 $"; + return "0.75, $Revision: 1.7 $"; } /* }}} */
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php