fix memory and dynamic array
This commit is contained in:
parent
ee25688b42
commit
f5b0a248ab
2 changed files with 6 additions and 6 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Reference in a new issue