From 6649b840c34016b4753e69d4513a8d09da9febb2 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Mon, 12 Jun 2017 16:51:04 +0200 Subject: mesa/util: add a hash table wrapper which support 64-bit keys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Needed for bindless handles which are represented using 64-bit unsigned integers. All hash table implementations should be uniformized later on. Signed-off-by: Samuel Pitoiset Reviewed-by: Nicolai Hähnle --- src/util/hash_table.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/util/hash_table.h') diff --git a/src/util/hash_table.h b/src/util/hash_table.h index c7f577665dc..cf939130fcf 100644 --- a/src/util/hash_table.h +++ b/src/util/hash_table.h @@ -153,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 -- cgit v1.2.3