libgo: update to Go 1.11
[official-gcc.git] / libgo / go / internal / bytealg / index_native.go
blob26f4769c2a0e5c0dd6fab85a4fbb98278a0eb3ae
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.
5 // -build amd64 arm64 s390x
7 package bytealg
9 //go:noescape
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
15 //go:noescape
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
21 func Cutover(n int) int {
22 // 1 error per 8 characters, plus a few slop to start.
23 return (n + 16) / 8