summaryrefslogtreecommitdiffstats
path: root/src/util/set.h
diff options
context:
space:
mode:
authorConnor Abbott <[email protected]>2019-03-27 12:00:54 +0100
committerConnor Abbott <[email protected]>2019-05-31 19:13:45 +0200
commit8a838e172f3f796b2d5d01cb51e05b37ae6f48f5 (patch)
tree665ab3631440346c62107ea29da55e6fec91f61c /src/util/set.h
parent1db86d8b62860380c34af77ae62b019ed2376443 (diff)
util/set: Add a _mesa_set_search_or_add() function
Unlike _mesa_set_search_and_add(), it doesn't replace an entry if it's found, returning it instead. This is useful for nir_instr_set, where we have to know both the original original instruction and its equivalent. Reviewed-by: Eric Anholt <[email protected]> Acked-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/util/set.h')
-rw-r--r--src/util/set.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/util/set.h b/src/util/set.h
index 5742c311a77..783c3d41c46 100644
--- a/src/util/set.h
+++ b/src/util/set.h
@@ -76,6 +76,12 @@ struct set_entry *
_mesa_set_add_pre_hashed(struct set *set, uint32_t hash, const void *key);
struct set_entry *
+_mesa_set_search_or_add(struct set *set, const void *key);
+struct set_entry *
+_mesa_set_search_or_add_pre_hashed(struct set *set, uint32_t hash,
+ const void *key);
+
+struct set_entry *
_mesa_set_search(const struct set *set, const void *key);
struct set_entry *
_mesa_set_search_pre_hashed(const struct set *set, uint32_t hash,