summaryrefslogtreecommitdiff
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
commit0e4a8b898639a06840749e7d2ca0b4596d97ad5b (patch)
treea0342d0590c6cd7957842819a099c61da5228c0d
parent22b0e6fd80b82c942d8842dc45fcdfd027aaff03 (diff)
add rbtree.SearchRange
-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