Back to index

glibc  2.9
Functions
hash-string.c File Reference
#include "hash-string.h"

Go to the source code of this file.

Functions

unsigned long int __hash_string (char *str_param) const

Function Documentation

unsigned long int __hash_string ( char *  str_param) const

Definition at line 27 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;
}

Here is the caller graph for this function: