summaryrefslogtreecommitdiff
path: root/pkg/util
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2022-06-30 02:46:33 -0600
committerLuke Shumaker <lukeshu@lukeshu.com>2022-06-30 02:46:33 -0600
commit74f15aa6a5c04bab0615262d005eace4fc2baedb (patch)
tree600c5c5278e7c44c19396c65f79611e3a6d9f464 /pkg/util
parent2f3acf6ffb4e9f2eef496e1c67d156f4f8e049db (diff)
add rbtree.SearchRange
Diffstat (limited to 'pkg/util')
-rw-r--r--pkg/util/generic.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/pkg/util/generic.go b/pkg/util/generic.go
index 520d94e..6474ea5 100644
--- a/pkg/util/generic.go
+++ b/pkg/util/generic.go
@@ -35,6 +35,13 @@ func RemoveAllFromSliceFunc[T any](haystack []T, f func(T) bool) []T {
return haystack
}
+func ReverseSlice[T any](slice []T) {
+ for i := 0; i < len(slice)/2; i++ {
+ j := (len(slice) - 1) - i
+ slice[i], slice[j] = slice[j], slice[i]
+ }
+}
+
func Max[T constraints.Ordered](a, b T) T {
if a > b {
return a