Mesa (master): mesa: use pre_hashed version of search for the mesa hash table

Timothy Arceri tarceri at kemper.freedesktop.org
Wed Apr 12 02:00:47 UTC 2017


Module: Mesa
Branch: master
Commit: c72170fb1fccbf5a9f538fa080bd76b9264b608f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c72170fb1fccbf5a9f538fa080bd76b9264b608f

Author: Timothy Arceri <tarceri at itsqueeze.com>
Date:   Mon Apr 10 22:21:37 2017 +1000

mesa: use pre_hashed version of search for the mesa hash table

The key is just an unsigned int so there is never any real hashing
done.

Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/mesa/main/hash.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c
index 670438add2..b7a7bd9f64 100644
--- a/src/mesa/main/hash.c
+++ b/src/mesa/main/hash.c
@@ -183,7 +183,9 @@ _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_key(key));
+   entry = _mesa_hash_table_search_pre_hashed(table->ht,
+                                              uint_hash(key),
+                                              uint_key(key));
    if (!entry)
       return NULL;
 
@@ -347,7 +349,9 @@ _mesa_HashRemove_unlocked(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_key(key));
+      entry = _mesa_hash_table_search_pre_hashed(table->ht,
+                                                 uint_hash(key),
+                                                 uint_key(key));
       _mesa_hash_table_remove(table->ht, entry);
    }
 }




More information about the mesa-commit mailing list