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:
parent
fe3639d547
commit
4edccce9a3
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user