#include "main/hash.h"
#include "fast_urem_by_const.h"
+#define XXH_INLINE_ALL
+#include "xxhash.h"
+
static const uint32_t deleted_key_value;
/**
uint32_t
_mesa_hash_data(const void *data, size_t size)
{
- return _mesa_fnv32_1a_accumulate_block(_mesa_fnv32_1a_offset_bias,
- data, size);
+ return XXH32(data, size, 0);
+}
+
+uint32_t
+_mesa_hash_int(const void *key)
+{
+ return XXH32(key, sizeof(int), 0);
+}
+
+uint32_t
+_mesa_hash_uint(const void *key)
+{
+ return XXH32(key, sizeof(unsigned), 0);
+}
+
+uint32_t
+_mesa_hash_u32(const void *key)
+{
+ return XXH32(key, 4, 0);
}
/** FNV-1a string hash implementation */
return hash;
}
+uint32_t
+_mesa_hash_pointer(const void *pointer)
+{
+ uintptr_t num = (uintptr_t) pointer;
+ return (uint32_t) ((num >> 2) ^ (num >> 6) ^ (num >> 10) ^ (num >> 14));
+}
+
+bool
+_mesa_key_int_equal(const void *a, const void *b)
+{
+ return *((const int *)a) == *((const int *)b);
+}
+
+bool
+_mesa_key_uint_equal(const void *a, const void *b)
+{
+
+ return *((const unsigned *)a) == *((const unsigned *)b);
+}
+
+bool
+_mesa_key_u32_equal(const void *a, const void *b)
+{
+ return *((const uint32_t *)a) == *((const uint32_t *)b);
+}
+
/**
* String compare function for use as the comparison callback in
* _mesa_hash_table_create().