SLOW_BUILD, 2 additional build targets, improve word complete

This commit is contained in:
Krzosa Karol
2026-01-25 08:54:00 +01:00
parent 863f140edc
commit 7ae4e74f50
9 changed files with 78 additions and 30 deletions

View File

@@ -165,7 +165,7 @@ Slice<T> GetSlice(Slice<T> &arr, int64_t first_index = 0, int64_t one_past_last_
}
// Make arrays resize on every item
#define ARRAY_DEBUG 0
#define ARRAY_DEBUG BUILD_SLOW
#if ARRAY_DEBUG
#define ARRAY_IF_DEBUG_ELSE(IF, ELSE) IF
#else
@@ -310,6 +310,16 @@ bool Contains(Array<T> &arr, T item) {
return false;
}
template<class T>
int64_t FindValueIndex(Array<T> &arr, T item) {
for (int64_t i = 0; i < arr.len; i += 1) {
if (arr.data[i] == item) {
return i;
}
}
return -1;
}
template <class T>
int64_t GetIndex(Array<T> &arr, const T &item) {
ptrdiff_t index = (ptrdiff_t)(&item - arr.data);