fix memory and dynamic array

This commit is contained in:
Judah Caruso 2025-06-02 13:32:13 -06:00
parent ee25688b42
commit f5b0a248ab
2 changed files with 6 additions and 6 deletions

View file

@ -20,9 +20,9 @@ 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);
resize :: inline (arr: *[..]$T, new_count: int) {
if new_count <= arr.allocated return;
basic.array_reserve(arr, new_count,, allocator = arr.allocator);
}
remove_ordered :: inline (arr: *[..]$T, index: int, loc := #caller_location) #no_abc {

View file

@ -67,9 +67,9 @@ init_or_zero :: inline (ptr: *$T, custom_init: (*T) = null) {
custom_init(ptr);
}
init :: initializer_of(T);
if init != null {
inline init(ptr);
initializer :: initializer_of(T);
#if initializer {
inline initializer(ptr);
}
else {
memset(ptr, 0, size_of(T));