summaryrefslogtreecommitdiff
path: root/src/dged/hash.h
blob: 0fd689b6f3debe0310dcf00acdf8612de1b8e47a (plain)
1
2
3
4
5
6
7
8
9
10
11
#include <stdint.h>

static uint32_t hash_name(const char *s) {
  unsigned long hash = 5381;
  int c;

  while ((c = *s++))
    hash = ((hash << 5) + hash) + c; /* hash * 33 + c */

  return hash;
}