aboutsummaryrefslogtreecommitdiff
path: root/src/ptr_set.cpp
diff options
context:
space:
mode:
authorDaniel Gavin <danielgavin5@hotmail.com>2022-01-24 16:58:39 +0100
committerDaniel Gavin <danielgavin5@hotmail.com>2022-01-24 16:58:39 +0100
commit6a7d821fcc42e58bb90b78f484c70dfa42a56c91 (patch)
tree1d5eede5f6831754489e9ed9677fa9d0006c40df /src/ptr_set.cpp
parent01e29bf27ef0204f586b856363f7a3bf5138052d (diff)
parent42ab882db4a6d5765c68021ade010b468ff4531e (diff)
Merge remote-tracking branch 'upstream/master' into parser-fix
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) {