+
+ hash ^= hash >> rot;
+ hash *= mix;
+ hash ^= hash >> rot;
+
+ return (uint32_t)(hash % ht->size);
+}
+
+#else
+static GMQCC_INLINE uint32_t util_hthashfunc(hash_table_t *ht, const char *key, size_t seed) {
+ const uint32_t mix = 0x5BD1E995;
+ const uint32_t rot = 24;
+ size_t size = strlen(key);
+ uint32_t hash = seed ^ size;
+ uint32_t alias = 0;
+ const unsigned char *data = (const unsigned char*)key;
+
+ while (size >= 4) {
+ alias = *(uint32_t*)data;
+
+ alias *= mix;
+ alias ^= alias >> rot;
+ alias *= mix;
+
+ hash *= mix;
+ hash ^= alias;
+
+ data += 4;
+ size -= 4;
+ }
+
+ switch (size) {
+ case 3: hash ^= data[2] << 16;
+ case 2: hash ^= data[1] << 8;
+ case 1: hash ^= data[0];
+ hash *= mix;
+ }
+
+ hash ^= hash >> 13;
+ hash *= mix;
+ hash ^= hash >> 15;
+
+ return hash % ht->size;
+}
+#endif
+
+/* we use the crc table as seeds for the murmur hash :P */
+size_t util_hthash(hash_table_t *ht, const char *key) {
+ static size_t seed = 0;
+ register size_t hash = util_hthashfunc(ht, key, util_crc32_table[seed]);
+
+ /* reset seed */
+ if (seed >= sizeof(util_crc32_table) / sizeof(*util_crc32_table))
+ seed = 0;
+
+ return hash;