aboutsummaryrefslogtreecommitdiff
path: root/src/ptr_set.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2022-01-23 15:40:46 +0000
committergingerBill <bill@gingerbill.org>2022-01-23 15:40:46 +0000
commit56b4e0a3c393dd0d820b4d82467c33e0e72298a6 (patch)
tree40ce1e75cda0398a2239a92c117d7c94f75da70f /src/ptr_set.cpp
parent27dbe84f79f917998cc472d4bcb0a6a93811b1b8 (diff)
Fix #1267
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) {