array: sort ints

pull/1819/head
Alexander Medvednikov 2019-09-01 20:55:34 +03:00
parent fe3639d547
commit 4edccce9a3
1 changed files with 14 additions and 0 deletions

View File

@ -259,3 +259,17 @@ pub fn copy(dst, src []byte) int {
}
return 0
}
fn compare_ints(a, b *int) int {
if a < b {
return -1
}
if a > b {
return 1
}
return 0
}
pub fn (a mut []int) sort() {
a.sort_with_compare(compare_ints)
}