mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-03 09:37:38 +00:00
16 lines
294 B
Go
16 lines
294 B
Go
package common
|
|
|
|
func SliceReverse[T any](s []T) {
|
|
for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {
|
|
s[i], s[j] = s[j], s[i]
|
|
}
|
|
}
|
|
|
|
func SliceMap[T any, U any](s []T, mapFunc func(T) U) []U {
|
|
out := make([]U, 0, len(s))
|
|
for _, x := range s {
|
|
out = append(out, mapFunc(x))
|
|
}
|
|
return out
|
|
}
|