Back to index

courier  0.68.2
Defines | Functions
hash-string.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define HASHWORDBITS   32
#define __hash_string   hash_string

Functions

unsigned long int __hash_string (const char *str_param)

Define Documentation

#define __hash_string   hash_string

Definition at line 29 of file hash-string.h.

#define HASHWORDBITS   32

Definition at line 22 of file hash-string.h.


Function Documentation

unsigned long int __hash_string ( const char *  str_param)

Definition at line 32 of file hash-string.c.

{
  unsigned long int hval, g;
  const char *str = str_param;

  /* Compute the hash value for the given string.  */
  hval = 0;
  while (*str != '\0')
    {
      hval <<= 4;
      hval += (unsigned char) *str++;
      g = hval & ((unsigned long int) 0xf << (HASHWORDBITS - 4));
      if (g != 0)
       {
         hval ^= g >> (HASHWORDBITS - 8);
         hval ^= g;
       }
    }
  return hval;
}