diff options
Diffstat (limited to 'src/bytes/bytes_arm64.go')
| -rw-r--r-- | src/bytes/bytes_arm64.go | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/src/bytes/bytes_arm64.go b/src/bytes/bytes_arm64.go deleted file mode 100644 index 39e9562db1..0000000000 --- a/src/bytes/bytes_arm64.go +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package bytes - -func countByte(s []byte, c byte) int // bytes_arm64.s - -// 8 bytes can be completely loaded into 1 register. -const shortStringLen = 8 - -//go:noescape -func indexShortStr(s, sep []byte) int - -// Index returns the index of the first instance of sep in s, or -1 if sep is not present in s. -func Index(s, sep []byte) int { - n := len(sep) - switch { - case n == 0: - return 0 - case n == 1: - return IndexByte(s, sep[0]) - case n == len(s): - if Equal(sep, s) { - return 0 - } - return -1 - case n > len(s): - return -1 - case n <= shortStringLen: - // Use brute force when both s and sep are small. - // Empirical data shows that it can get better - // performance when len(s) <= 16. - if len(s) <= 16 { - return indexShortStr(s, sep) - } - } - c := sep[0] - i := 0 - fails := 0 - t := s[:len(s)-n+1] - for i < len(t) { - if t[i] != c { - o := IndexByte(t[i:], c) - if o < 0 { - break - } - i += o - } - if Equal(s[i:i+n], sep) { - return i - } - i++ - fails++ - if fails >= 4+i>>4 && i < len(t) { - // Give up on IndexByte, it isn't skipping ahead - // far enough to be better than Rabin-Karp. - // Experiments (using IndexPeriodic) suggest - // the cutover is about 16 byte skips. - // TODO: if large prefixes of sep are matching - // we should cutover at even larger average skips, - // because Equal becomes that much more expensive. - // This code does not take that effect into account. - j := indexRabinKarp(s[i:], sep) - if j < 0 { - return -1 - } - return i + j - } - } - return -1 -} |
