1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

array: sort ints

This commit is contained in:
Alexander Medvednikov 2019-09-01 20:55:34 +03:00
parent fe3639d547
commit 4edccce9a3

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)
}