mirror of
https://github.com/odin-lang/Odin.git
synced 2025-12-29 01:14:40 +00:00
-go-to-definitions (OGTD file format)
This commit is contained in:
@@ -33,6 +33,7 @@ template <typename T> Array<T> array_make (gbAllocator const &a, isize
|
||||
template <typename T> Array<T> array_make_from_ptr (T *data, isize count, isize capacity);
|
||||
template <typename T> void array_free (Array<T> *array);
|
||||
template <typename T> void array_add (Array<T> *array, T const &t);
|
||||
template <typename T> void array_add_elems (Array<T> *array, T const *elems, isize elem_count);
|
||||
template <typename T> T array_pop (Array<T> *array);
|
||||
template <typename T> void array_clear (Array<T> *array);
|
||||
template <typename T> void array_reserve (Array<T> *array, isize capacity);
|
||||
@@ -157,6 +158,17 @@ void array_add(Array<T> *array, T const &t) {
|
||||
array->count++;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void array_add_elems(Array<T> *array, T const *elems, isize elem_count) {
|
||||
GB_ASSERT(elem_count >= 0);
|
||||
if (array->capacity < array->count+elem_count) {
|
||||
array__grow(array, array->count+elem_count);
|
||||
}
|
||||
gb_memmove(array->data + array->count, elems, elem_count * gb_size_of(T));
|
||||
array->count += elem_count;
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
gb_inline T array_pop(Array<T> *array) {
|
||||
GB_ASSERT(array->count > 0);
|
||||
|
||||
Reference in New Issue
Block a user