32 lines
749 B
Text
32 lines
749 B
Text
// @todo(judah): replace array_add
|
|
|
|
append :: inline (arr: *[..]$T, value: T) -> *T {
|
|
ptr := basic.array_add(arr,, allocator = arr.allocator);
|
|
ptr.* = value;
|
|
return ptr;
|
|
}
|
|
|
|
append :: inline (arr: *[..]$T, values: ..T) -> *T {
|
|
count := arr.count;
|
|
basic.array_add(arr, ..values,, allocator = arr.allocator);
|
|
return *arr.data[count];
|
|
}
|
|
|
|
append :: inline (arr: *[..]$T) -> *T {
|
|
return basic.array_add(arr,, allocator = arr.allocator);
|
|
}
|
|
|
|
resize :: inline (arr: *[..]$T, new_size: int) {
|
|
if new_size <= arr.allocated return;
|
|
basic.array_reserve(arr, new_size,, allocator = arr.allocator);
|
|
}
|
|
|
|
reset :: inline (arr: *[..]$T) {
|
|
arr.count = 0;
|
|
}
|
|
|
|
|
|
#scope_file;
|
|
|
|
mem :: #import "jc/memory";
|
|
basic :: #import "Basic"; // @future
|