mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-29 19:00:06 +00:00
add tests for sort_by_indices
This commit is contained in:
@@ -45,11 +45,12 @@ sort_by_indices :: proc(data: $T/[]$E, indices: []int, allocator := context.allo
|
||||
for v, i in indices {
|
||||
sorted[i] = data[v]
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
sort_by_indices_overwrite :: proc(data: $T/[]$E, indices: []int) {
|
||||
assert(len(data) == len(indices))
|
||||
temp := make([]int, len(data), context.temp_allocator)
|
||||
temp := make([]int, len(data), context.allocator)
|
||||
defer delete(temp)
|
||||
for v, i in indices {
|
||||
temp[i] = data[v]
|
||||
|
||||
Reference in New Issue
Block a user