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);
|
return basic.array_add(arr,, allocator = arr.allocator);
|
||||||
}
|
}
|
||||||
|
|
||||||
resize :: inline (arr: *[..]$T, new_size: int) {
|
resize :: inline (arr: *[..]$T, new_count: int) {
|
||||||
if new_size <= arr.allocated return;
|
if new_count <= arr.allocated return;
|
||||||
basic.array_reserve(arr, new_size,, allocator = arr.allocator);
|
basic.array_reserve(arr, new_count,, allocator = arr.allocator);
|
||||||
}
|
}
|
||||||
|
|
||||||
remove_ordered :: inline (arr: *[..]$T, index: int, loc := #caller_location) #no_abc {
|
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);
|
custom_init(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
init :: initializer_of(T);
|
initializer :: initializer_of(T);
|
||||||
if init != null {
|
#if initializer {
|
||||||
inline init(ptr);
|
inline initializer(ptr);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
memset(ptr, 0, size_of(T));
|
memset(ptr, 0, size_of(T));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue