diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2021-09-18 12:55:13 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-18 12:55:13 +0100 |
| commit | 6855538729ea4f859f692715c4c231e4a59ac604 (patch) | |
| tree | f9bd2df2289ab97032170151da38b076df00e0f6 /src/array.cpp | |
| parent | 15921d032cfff6994289d1f299bef168f0a49a4e (diff) | |
| parent | 05ac2002e0296c3acccca1d8cffaafb002e43120 (diff) | |
Merge branch 'master' into llvm-12.0.1-windows
Diffstat (limited to 'src/array.cpp')
| -rw-r--r-- | src/array.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/array.cpp b/src/array.cpp index 90d85563c..521fa91e2 100644 --- a/src/array.cpp +++ b/src/array.cpp @@ -151,6 +151,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); |