diff options
author | Samuel Pitoiset <[email protected]> | 2017-06-12 16:51:04 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2017-06-14 10:04:35 +0200 |
commit | 6649b840c34016b4753e69d4513a8d09da9febb2 (patch) | |
tree | 90d4aabddab719a79670b8e6dd91b9d3da9bcd7a /src/util/hash_table.h | |
parent | eeb34af5be5aff36a8ccf94b5d202ef0b9d0c992 (diff) |
mesa/util: add a hash table wrapper which support 64-bit keys
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 <[email protected]>
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/util/hash_table.h')
-rw-r--r-- | src/util/hash_table.h | 25 |
1 files changed, 25 insertions, 0 deletions
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 |