aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/hash.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2015-02-22 21:39:56 +0100
committermarha <marha@users.sourceforge.net>2015-02-22 21:39:56 +0100
commit462f18c7b25fe3e467f837647d07ab0a78aa8d2b (patch)
treefc8013c0a1bac05a1945846c1697e973f4c35013 /mesalib/src/mesa/main/hash.c
parent36f711ee12b6dd5184198abed3aa551efb585587 (diff)
downloadvcxsrv-462f18c7b25fe3e467f837647d07ab0a78aa8d2b.tar.gz
vcxsrv-462f18c7b25fe3e467f837647d07ab0a78aa8d2b.tar.bz2
vcxsrv-462f18c7b25fe3e467f837647d07ab0a78aa8d2b.zip
Merged origin/release (checked in because wanted to merge new stuff)
Diffstat (limited to 'mesalib/src/mesa/main/hash.c')
-rw-r--r--mesalib/src/mesa/main/hash.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/mesalib/src/mesa/main/hash.c b/mesalib/src/mesa/main/hash.c
index 52095f7d1..1a152ec34 100644
--- a/mesalib/src/mesa/main/hash.c
+++ b/mesalib/src/mesa/main/hash.c
@@ -96,6 +96,12 @@ uint_hash(GLuint id)
return id;
}
+static uint32_t
+uint_key_hash(const void *key)
+{
+ return uint_hash((uintptr_t)key);
+}
+
static void *
uint_key(GLuint id)
{
@@ -114,7 +120,8 @@ _mesa_NewHashTable(void)
struct _mesa_HashTable *table = CALLOC_STRUCT(_mesa_HashTable);
if (table) {
- table->ht = _mesa_hash_table_create(NULL, uint_key_compare);
+ table->ht = _mesa_hash_table_create(NULL, uint_key_hash,
+ uint_key_compare);
if (table->ht == NULL) {
free(table);
_mesa_error_no_memory(__func__);
@@ -175,7 +182,7 @@ _mesa_HashLookup_unlocked(struct _mesa_HashTable *table, GLuint key)
if (key == DELETED_KEY_VALUE)
return table->deleted_key_data;
- entry = _mesa_hash_table_search(table->ht, uint_hash(key), uint_key(key));
+ entry = _mesa_hash_table_search(table->ht, uint_key(key));
if (!entry)
return NULL;
@@ -266,11 +273,11 @@ _mesa_HashInsert_unlocked(struct _mesa_HashTable *table, GLuint key, void *data)
if (key == DELETED_KEY_VALUE) {
table->deleted_key_data = data;
} else {
- entry = _mesa_hash_table_search(table->ht, hash, uint_key(key));
+ entry = _mesa_hash_table_search_pre_hashed(table->ht, hash, uint_key(key));
if (entry) {
entry->data = data;
} else {
- _mesa_hash_table_insert(table->ht, hash, uint_key(key), data);
+ _mesa_hash_table_insert_pre_hashed(table->ht, hash, uint_key(key), data);
}
}
}
@@ -340,7 +347,7 @@ _mesa_HashRemove(struct _mesa_HashTable *table, GLuint key)
if (key == DELETED_KEY_VALUE) {
table->deleted_key_data = NULL;
} else {
- entry = _mesa_hash_table_search(table->ht, uint_hash(key), uint_key(key));
+ entry = _mesa_hash_table_search(table->ht, uint_key(key));
_mesa_hash_table_remove(table->ht, entry);
}
mtx_unlock(&table->Mutex);