/*
*/


#include "hash.h"

/*
 * this is the SDBM hash function from:
 * http://en.literateprograms.org/Hash_function_comparison_%28C,_sh%29
 */
hash_t
sdbm_hash (const char * key) {
  hash_t h=0;
  while(*key) h=*key++ + (h<<6) + (h<<16) - h;
  return h;
}

hash_t
s_hash_object (const spointer obj) {
  /* We take the address of the pointer. */
  hash_t tmp_val = S_POINTER_TO_HASH_T(obj);
  /* Scrable it up a bit */
  hash_t ret_val = (tmp_val<<6);
  ret_val += (ret_val<<16);
  return ret_val;
}
