summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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