Add mem.clone_slice

This commit is contained in:
gingerBill
2020-09-15 11:51:38 +01:00
parent 0cd681e6b7
commit 4930a9c1a4
+8
View File
@@ -279,3 +279,11 @@ calc_padding_with_header :: proc(ptr: uintptr, align: uintptr, header_size: int)
return int(padding);
}
clone_slice :: proc(slice: $T/[]$E, allocator := context.allocator, loc := #caller_location) -> T {
new_slice := make(T, len(slice), allocator, loc);
copy(new_slice, slice);
return new_slice;
}