aboutsummaryrefslogtreecommitdiff
path: root/src/ptr_set.cpp
diff options
context:
space:
mode:
authorJeroen van Rijn <Kelimion@users.noreply.github.com>2022-04-27 14:37:15 +0200
committerJeroen van Rijn <Kelimion@users.noreply.github.com>2022-04-27 14:37:15 +0200
commitc4e0d1efa1ec655bae9134b95a0fcd060cc7bbea (patch)
treec29bd0b78138e8d67aebe34ac689d13e32d9d15f /src/ptr_set.cpp
parent6e61abc7d06f22129f93110a9f652c3eec21f0c6 (diff)
parent9349dfba8fec53f52f77a0c8928e115ec93ff447 (diff)
Merge branch 'master' into xml
Diffstat (limited to 'src/ptr_set.cpp')
-rw-r--r--src/ptr_set.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/ptr_set.cpp b/src/ptr_set.cpp
index ca7df3b53..b45997916 100644
--- a/src/ptr_set.cpp
+++ b/src/ptr_set.cpp
@@ -138,6 +138,15 @@ gb_inline bool ptr_set_exists(PtrSet<T> *s, T ptr) {
return index != MAP_SENTINEL;
}
+template <typename T>
+gb_inline isize ptr_entry_index(PtrSet<T> *s, T ptr) {
+ isize index = ptr_set__find(s, ptr).entry_index;
+ if (index != MAP_SENTINEL) {
+ return index;
+ }
+ return -1;
+}
+
// Returns true if it already exists
template <typename T>
T ptr_set_add(PtrSet<T> *s, T ptr) {