]> de.git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - util.c
Remove hash.c
[xonotic/gmqcc.git] / util.c
diff --git a/util.c b/util.c
index 10fd9f47b4c6a4af713039884e3e69df6f2071a4..02ac1a1247fdcb925f6db56a664add8c0fa5427e 100644 (file)
--- a/util.c
+++ b/util.c
@@ -758,3 +758,16 @@ void util_seed(uint32_t value) {
         (void)util_rand();
 }
 
+size_t hash(const char *string) {
+    size_t hash = 0;
+    for(; *string; ++string) {
+        hash += *string;
+        hash += (hash << 10);
+        hash ^= (hash >> 6);
+    }
+    hash += hash << 3;
+    hash ^= hash >> 11;
+    hash += hash << 15;
+    return hash;
+}
+