summaryrefslogtreecommitdiff
path: root/lib/mesa/src/util/hash_table.h
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2017-12-31 06:39:08 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2017-12-31 06:39:08 +0000
commit2dae6fe6f74cf7fb9fd65285302c0331d9786b00 (patch)
tree04651e732331dc50a34e063cbaa0c394ccfcd327 /lib/mesa/src/util/hash_table.h
parentb90fb74e3c85f2799d21d1e07bf91c5fb8359eb8 (diff)
Import Mesa 17.2.8
Diffstat (limited to 'lib/mesa/src/util/hash_table.h')
-rw-r--r--lib/mesa/src/util/hash_table.h28
1 files changed, 27 insertions, 1 deletions
diff --git a/lib/mesa/src/util/hash_table.h b/lib/mesa/src/util/hash_table.h
index b35ee871b..cf939130f 100644
--- a/lib/mesa/src/util/hash_table.h
+++ b/lib/mesa/src/util/hash_table.h
@@ -105,7 +105,8 @@ static inline uint32_t _mesa_key_hash_string(const void *key)
static inline uint32_t _mesa_hash_pointer(const void *pointer)
{
- return _mesa_hash_data(&pointer, sizeof(pointer));
+ uintptr_t num = (uintptr_t) pointer;
+ return (uint32_t) ((num >> 2) ^ (num >> 6) ^ (num >> 10) ^ (num >> 14));
}
enum {
@@ -152,6 +153,31 @@ hash_table_call_foreach(struct hash_table *ht,
callback(entry->key, entry->data, closure);
}
+/**
+ * Hash table wrapper which supports 64-bit keys.
+ */
+struct hash_table_u64 {
+ struct hash_table *table;
+ void *deleted_key_data;
+};
+
+struct hash_table_u64 *
+_mesa_hash_table_u64_create(void *mem_ctx);
+
+void
+_mesa_hash_table_u64_destroy(struct hash_table_u64 *ht,
+ void (*delete_function)(struct hash_entry *entry));
+
+void
+_mesa_hash_table_u64_insert(struct hash_table_u64 *ht, uint64_t key,
+ void *data);
+
+void *
+_mesa_hash_table_u64_search(struct hash_table_u64 *ht, uint64_t key);
+
+void
+_mesa_hash_table_u64_remove(struct hash_table_u64 *ht, uint64_t key);
+
#ifdef __cplusplus
} /* extern C */
#endif