summaryrefslogtreecommitdiff
path: root/src/dged/hash.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/dged/hash.h')
-rw-r--r--src/dged/hash.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/dged/hash.h b/src/dged/hash.h
new file mode 100644
index 0000000..0fd689b
--- /dev/null
+++ b/src/dged/hash.h
@@ -0,0 +1,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;
+}