OXIESEC PANEL
- Current Dir:
/
/
opt
/
golang
/
1.19.4
/
src
/
sort
Server IP: 2a02:4780:11:1084:0:327f:3464:10
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
12/01/2022 06:13:58 PM
rwxr-xr-x
📄
example_interface_test.go
1.47 KB
12/01/2022 06:13:00 PM
rw-r--r--
📄
example_keys_test.go
2.68 KB
12/01/2022 06:13:00 PM
rw-r--r--
📄
example_multi_test.go
4.05 KB
12/01/2022 06:13:00 PM
rw-r--r--
📄
example_search_test.go
2.12 KB
12/01/2022 06:13:00 PM
rw-r--r--
📄
example_test.go
2.85 KB
12/01/2022 06:13:00 PM
rw-r--r--
📄
example_wrapper_test.go
1.63 KB
12/01/2022 06:13:00 PM
rw-r--r--
📄
export_test.go
314 bytes
12/01/2022 06:13:00 PM
rw-r--r--
📄
gen_sort_variants.go
18.21 KB
12/01/2022 06:13:00 PM
rw-r--r--
📄
search.go
5.66 KB
12/01/2022 06:13:00 PM
rw-r--r--
📄
search_test.go
6.78 KB
12/01/2022 06:13:00 PM
rw-r--r--
📄
slice.go
1.43 KB
12/01/2022 06:13:00 PM
rw-r--r--
📄
slice_go113.go
323 bytes
12/01/2022 06:13:00 PM
rw-r--r--
📄
slice_go14.go
478 bytes
12/01/2022 06:13:00 PM
rw-r--r--
📄
slice_go18.go
319 bytes
12/01/2022 06:13:00 PM
rw-r--r--
📄
sort.go
9.42 KB
12/01/2022 06:13:00 PM
rw-r--r--
📄
sort_test.go
16.45 KB
12/01/2022 06:13:00 PM
rw-r--r--
📄
zsortfunc.go
11.49 KB
12/01/2022 06:13:00 PM
rw-r--r--
📄
zsortinterface.go
11.22 KB
12/01/2022 06:13:00 PM
rw-r--r--
Editing: slice.go
Close
// Copyright 2017 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package sort import "math/bits" // Slice sorts the slice x given the provided less function. // It panics if x is not a slice. // // The sort is not guaranteed to be stable: equal elements // may be reversed from their original order. // For a stable sort, use SliceStable. // // The less function must satisfy the same requirements as // the Interface type's Less method. func Slice(x any, less func(i, j int) bool) { rv := reflectValueOf(x) swap := reflectSwapper(x) length := rv.Len() limit := bits.Len(uint(length)) pdqsort_func(lessSwap{less, swap}, 0, length, limit) } // SliceStable sorts the slice x using the provided less // function, keeping equal elements in their original order. // It panics if x is not a slice. // // The less function must satisfy the same requirements as // the Interface type's Less method. func SliceStable(x any, less func(i, j int) bool) { rv := reflectValueOf(x) swap := reflectSwapper(x) stable_func(lessSwap{less, swap}, rv.Len()) } // SliceIsSorted reports whether the slice x is sorted according to the provided less function. // It panics if x is not a slice. func SliceIsSorted(x any, less func(i, j int) bool) bool { rv := reflectValueOf(x) n := rv.Len() for i := n - 1; i > 0; i-- { if less(i, i-1) { return false } } return true }