status-go/vendor/github.com/anacrolix/missinggo/limitlen.go

8 lines
197 B
Go
Raw Normal View History

2022-03-10 09:44:48 +00:00
package missinggo
// Sets an upper bound on the len of b. max can be any type that will cast to
// int64.
func LimitLen(b []byte, max ...interface{}) []byte {
return b[:MinInt(len(b), max...)]
}