aboutsummaryrefslogtreecommitdiff
path: root/src/ptr_set.cpp
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2022-02-15 15:47:24 +0000
committerGitHub <noreply@github.com>2022-02-15 15:47:24 +0000
commitf5697dd7f2e71411957faf9fa620e62363491083 (patch)
tree931db0d1c595326524bd7a541b0fb2c6d4a7f186 /src/ptr_set.cpp
parent6223f48c3fc096b543a51aa1c993a6f1127f2a0f (diff)
parenta23ee1edc16dc447b9e342ba56b5871e0424082e (diff)
Merge branch 'master' into odin-global-constants-as-enums
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) {