File: limitlen.go

package info (click to toggle)
golang-github-anacrolix-missinggo 2.1.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 836 kB
  • sloc: makefile: 4
file content (7 lines) | stat: -rw-r--r-- 197 bytes parent folder | download
1
2
3
4
5
6
7
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...)]
}