Begin minimize Type size by replacing Array with Slice etc

This commit is contained in:
gingerBill
2021-09-13 00:58:39 +01:00
parent 6585601765
commit fb8fa5217d
13 changed files with 147 additions and 110 deletions

View File

@@ -150,6 +150,19 @@ void slice_copy(Slice<T> *slice, Slice<T> const &data, isize offset, isize count
template <typename T>
gb_inline Slice<T> slice(Slice<T> const &array, isize lo, isize hi) {
GB_ASSERT(0 <= lo && lo <= hi && hi <= array.count);
Slice<T> out = {};
isize len = hi-lo;
if (len > 0) {
out.data = array.data+lo;
out.count = len;
}
return out;
}
template <typename T>
void slice_ordered_remove(Slice<T> *array, isize index) {
GB_ASSERT(0 <= index && index < array->count);