--- str_hash.c 2002/04/01 08:32:54 1.6
+++ str_hash.c 2003/01/06 19:13:47 1.7
@@ -1,9 +1,9 @@
/*
** OSSP str - String Handling
-** Copyright (c) 1999-2002 Ralf S. Engelschall <rse@engelschall.com>
-** Copyright (c) 1999-2002 The OSSP Project <http://www.ossp.org/>
+** Copyright (c) 1999-2003 Ralf S. Engelschall <rse@engelschall.com>
+** Copyright (c) 1999-2003 The OSSP Project <http://www.ossp.org/>
**
-** This file is part of OSSP str, a string handling and manipulation
+** This file is part of OSSP str, a string handling and manipulation
** library which can be found at http://www.ossp.org/pkg/lib/str/.
**
** Permission to use, copy, modify, and distribute this software for
@@ -24,7 +24,7 @@
** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
** SUCH DAMAGE.
**
-** str_hash.c: hashing functions
+** str_hash.c: hashing functions
*/
#include "str_p.h"
@@ -45,7 +45,7 @@
* even numbers are not useable at all. The remaining 128 odd numbers
* (except for the number 1) work more or less all equally well. They
* all distribute in an acceptable way and this way fill a hash table
- * with an average percent of approx. 86%.
+ * with an average percent of approx. 86%.
*
* If one compares the Chi/2 values resulting of the various
* multipliers, the 33 not even has the best value. But the 33 and a
@@ -58,9 +58,9 @@
* few values should be preferred and seems to be also the reason why
* Daniel J. Bernstein also preferred it.
*/
-static unsigned long
+static unsigned long
hash_djbx33(
- register unsigned char *key,
+ register unsigned char *key,
register str_size_t len)
{
register unsigned long hash = 5381;
@@ -103,7 +103,7 @@
* hash functions (i.e. same function signature). It can be definitely
* recommended as a very good general purpose hashing function.
*/
-static unsigned long
+static unsigned long
hash_bjddj(
register unsigned char *k,
register str_size_t length)
@@ -140,7 +140,7 @@
/* handle the last 11 bytes */
c += length;
- switch(len) {
+ switch(len) {
/* all the case statements fall through */
case 11: c += ((ub4)k[10]<<24);
case 10: c += ((ub4)k[ 9]<<16);
@@ -176,7 +176,7 @@
* hash function. It should be used if good distribution is more
* important than high performance.
*/
-static unsigned long
+static unsigned long
hash_macrc32(
register unsigned char *key,
register str_size_t len)
@@ -237,7 +237,7 @@
0x2d02ef8dL
};
register unsigned long hash;
-
+
/* compute hash with the help of the table */
hash = 0xffffffff;
while (len-- > 0)
@@ -251,10 +251,10 @@
/*
* The API function.
*/
-unsigned long
+unsigned long
str_hash(
- const char *s,
- str_size_t n,
+ const char *s,
+ str_size_t n,
int mode)
{
unsigned long hash;
|