c/snippets/hash_table.c
// calculate an index for h->buckets
calculate an index for h->buckets
calculate an index for h - > buckets
unsigned int ht_hash(HashTable* h, const char *key) {
  if (!key) key = "";
  unsigned int hash = 0;
  for (unsigned char *p = (unsigned char*)key; *p; p++)
    hash = 31*hash + *p;
  return hash & (h->buckets_len - 1);
}
unsigned int ht_hash ( HashTable * h , const char * key ) { if ( ! key ) key = " " ; unsigned int hash = 0 ; for ( unsigned char * p = ( unsigned char * ) key ; * p ; p ++ ) hash = 31 * hash + * p ; return hash & ( h -> buckets_len - 1 ) ; }
calculate an index for h->buckets
calculate an index for h - > buckets