SLOW_BUILD, 2 additional build targets, improve word complete
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
#define OS_POSIX 1
|
||||
#define OS_MAC 1
|
||||
@@ -70,6 +69,16 @@
|
||||
#define DEBUG_BUILD 1
|
||||
#endif
|
||||
|
||||
#ifndef SLOW_BUILD
|
||||
#define SLOW_BUILD 0
|
||||
#endif
|
||||
|
||||
#if SLOW_BUILD
|
||||
#define IF_SLOW_BUILD(x) x
|
||||
#else
|
||||
#define IF_SLOW_BUILD(x)
|
||||
#endif
|
||||
|
||||
#if DEBUG_BUILD
|
||||
#define IF_DEBUG(x) x
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user