mojoshader_common.c
changeset 734 1f69fc50c79c
parent 733 1b6d68fabe46
child 735 78c882b8c813
--- a/mojoshader_common.c	Sun Apr 05 03:31:52 2009 -0400
+++ b/mojoshader_common.c	Sun Apr 05 03:32:33 2009 -0400
@@ -134,5 +134,21 @@
     return 0;
 } // hash_remove
 
+
+// this is djb's xor hashing function.
+uint32 hash_hash_string(const void *_sym)
+{
+    register const char *sym = (const char *) _sym;
+    register uint32 hash = 5381;
+    while (*sym)
+        hash = ((hash << 5) + hash) ^ *(sym++);
+    return hash;
+} // hash_hash_string
+
+int hash_keymatch_string(const void *a, const void *b)
+{
+    return (strcmp((const char *) a, (const char *) b) == 0);
+} // hash_keymatch_string
+
 // end of mojoshader_common.c ...