This commit is contained in:
gingerBill
2022-01-23 15:40:46 +00:00
parent 27dbe84f79
commit 56b4e0a3c3
5 changed files with 35 additions and 13 deletions

View File

@@ -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) {