]> git.ipfire.org Git - thirdparty/gcc.git/blame - libgo/go/internal/bytealg/index_arm64.go
libgo: update to Go 1.13beta1 release
[thirdparty/gcc.git] / libgo / go / internal / bytealg / index_arm64.go
CommitLineData
dd931d9b
ILT
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// +build ignore_for_gccgo
6
7package bytealg
8
aa8901e9 9// Empirical data shows that using Index can get better
dd931d9b
ILT
10// performance when len(s) <= 16.
11const MaxBruteForce = 16
12
13func init() {
14 // Optimize cases where the length of the substring is less than 32 bytes
15 MaxLen = 32
16}
17
18// Cutover reports the number of failures of IndexByte we should tolerate
aa8901e9 19// before switching over to Index.
dd931d9b
ILT
20// n is the number of bytes processed so far.
21// See the bytes.Index implementation for details.
22func Cutover(n int) int {
23 // 1 error per 16 characters, plus a few slop to start.
24 return 4 + n>>4
25}