Imports #
_ "unsafe"
"unsafe"
"internal/cpu"
"unsafe"
_ "unsafe"
"internal/cpu"
"internal/cpu"
"internal/cpu"
_ "unsafe"
"unsafe"
"internal/cpu"
"unsafe"
_ "unsafe"
"internal/cpu"
"internal/cpu"
"internal/cpu"
Empirical data shows that using Index can get better performance when len(s) <= 16.
const MaxBruteForce = 16const MaxBruteForce = 16const MaxBruteForce = 64const MaxBruteForce = 0const MaxBruteForce = 64MaxLen is the maximum length of the string to be searched for (argument b) in Index. If MaxLen is not 0, make sure MaxLen >= 4.
var MaxLen intPrimeRK is the prime base used in Rabin-Karp algorithm.
const PrimeRK = 16777619var SupportsPower9 = cpu.PPC64.IsPOWER9Offsets into internal/cpu records for use in assembly.
const offsetPPC64HasPOWER9 = *ast.CallExprOffsets into internal/cpu records for use in assembly.
const offsetS390xHasVX = *ast.CallExprOffsets into internal/cpu records for use in assembly.
const offsetX86HasAVX2 = *ast.CallExprOffsets into internal/cpu records for use in assembly.
const offsetX86HasPOPCNT = *ast.CallExprOffsets into internal/cpu records for use in assembly.
const offsetX86HasSSE42 = *ast.CallExprgo:noescape
func Compare(a []byte, b []byte) intfunc Compare(a []byte, b []byte) intfunc CompareString(a string, b string) intfunc CompareString(a string, b string) intfunc Count(b []byte, c byte) intgo:noescape
func Count(b []byte, c byte) intgo:noescape
func CountString(s string, c byte) intfunc CountString(s string, c byte) intCutover reports the number of failures of IndexByte we should tolerate before switching over to Index. n is the number of bytes processed so far. See the bytes.Index implementation for details.
func Cutover(n int) intCutover reports the number of failures of IndexByte we should tolerate before switching over to Index. n is the number of bytes processed so far. See the bytes.Index implementation for details.
func Cutover(n int) intCutover reports the number of failures of IndexByte we should tolerate before switching over to Index. n is the number of bytes processed so far. See the bytes.Index implementation for details.
func Cutover(n int) intCutover reports the number of failures of IndexByte we should tolerate before switching over to Index. n is the number of bytes processed so far. See the bytes.Index implementation for details.
func Cutover(n int) intCutover reports the number of failures of IndexByte we should tolerate before switching over to Index. n is the number of bytes processed so far. See the bytes.Index implementation for details.
func Cutover(n int) intEqual reports whether a and b are the same length and contain the same bytes. A nil argument is equivalent to an empty slice. Equal is equivalent to bytes.Equal. It is provided here for convenience, because some packages cannot depend on bytes.
func Equal(a []byte, b []byte) boolHashStr returns the hash and the appropriate multiplicative factor for use in Rabin-Karp algorithm.
func HashStr(sep T) (uint32, uint32)HashStrRev returns the hash of the reverse of sep and the appropriate multiplicative factor for use in Rabin-Karp algorithm.
func HashStrRev(sep T) (uint32, uint32)Index returns the index of the first instance of b in a, or -1 if b is not present in a. Requires 2 <= len(b) <= MaxLen.
func Index(a []byte, b []byte) intIndex returns the index of the first instance of b in a, or -1 if b is not present in a. Requires 2 <= len(b) <= MaxLen. go:noescape
func Index(a []byte, b []byte) intgo:noescape
func IndexByte(b []byte, c byte) intfunc IndexByte(b []byte, c byte) intfunc IndexByteString(s string, c byte) intgo:noescape
func IndexByteString(s string, c byte) intIndexRabinKarp uses the Rabin-Karp search algorithm to return the index of the first occurrence of sep in s, or -1 if not present.
func IndexRabinKarp(s T, sep T) intIndexString returns the index of the first instance of b in a, or -1 if b is not present in a. Requires 2 <= len(b) <= MaxLen. go:noescape
func IndexString(a string, b string) intIndexString returns the index of the first instance of b in a, or -1 if b is not present in a. Requires 2 <= len(b) <= MaxLen.
func IndexString(a string, b string) intfunc LastIndexByte(s []byte, c byte) intfunc LastIndexByteString(s string, c byte) intLastIndexRabinKarp uses the Rabin-Karp search algorithm to return the last index of the occurrence of sep in s, or -1 if not present.
func LastIndexRabinKarp(s T, sep T) intMakeNoZero makes a slice of length n and capacity of at least n Bytes without zeroing the bytes (including the bytes between len and cap). It is the caller's responsibility to ensure uninitialized bytes do not leak to the end user.
func MakeNoZero(n int) []bytego:linkname abigen_runtime_cmpstring runtime.cmpstring
func abigen_runtime_cmpstring(a string, b string) intgo:linkname abigen_runtime_memequal runtime.memequal
func abigen_runtime_memequal(a unsafe.Pointer, b unsafe.Pointer, size uintptr) boolgo:linkname abigen_runtime_memequal_varlen runtime.memequal_varlen
func abigen_runtime_memequal_varlen(a unsafe.Pointer, b unsafe.Pointer) boolA backup implementation to use by assembly.
func countGeneric(b []byte, c byte) intfunc countGenericString(s string, c byte) intfunc init()func init()func init()func init()runtime.cmpstring calls are emitted by the compiler. runtime.cmpstring should be an internal detail, but widely used packages access it using linkname. Notable members of the hall of shame include: - gitee.com/zhaochuninhefei/gmgo - github.com/bytedance/gopkg - github.com/songzhibin97/gkit Do not remove or change the type signature. See go.dev/issue/67401. go:linkname runtime_cmpstring runtime.cmpstring
func runtime_cmpstring(a string, b string) intGenerated with Arrow