Debian Codegraph @

libgo/go/internal/bytealg/index_native.go

raw
1 // Copyright 2018 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 //-go:build amd64 || arm64 || s390x || ppc64le || ppc64
6
7 package bytealg
8
9 //go:noescape
10
11 // Index returns the index of the first instance of b in a, or -1 if b is not present in a.
12 // Requires 2 <= len(b) <= MaxLen.
13 func Index(a, b []byte) int
14
15 //go:noescape
16
17 // IndexString returns the index of the first instance of b in a, or -1 if b is not present in a.
18 // Requires 2 <= len(b) <= MaxLen.
19 func IndexString(a, b string) int
20
21 func Cutover(n int) int {
22 // 1 error per 8 characters, plus a few slop to start.
23 return (n + 16) / 8
24 }