Back to index

glibc  2.9
Defines | Functions
strlen-hash.h File Reference
#include <sys/types.h>

Go to the source code of this file.

Defines

#define HASHWORDBITS   32

Functions

static size_t hash_string (const char *__str_param, size_t __len)

Define Documentation

#define HASHWORDBITS   32

Definition at line 24 of file strlen-hash.h.


Function Documentation

static size_t hash_string ( const char *  __str_param,
size_t  __len 
) [inline, static]

Definition at line 33 of file strlen-hash.h.

{
  size_t hval, g;
  const char *end_str = str_param + len;

  /* Compute the hash value for the given string.  */
  hval = len;
  while (str_param != end_str)
    {
      hval <<= 4;
      hval += (size_t) *str_param++;
      g = hval & ((size_t) 0xf << (HASHWORDBITS - 4));
      if (g != 0)
       {
         hval ^= g >> (HASHWORDBITS - 8);
         hval ^= g;
       }
    }
  return hval;
}