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 = 16
const MaxBruteForce = 16
const MaxBruteForce = 64
const MaxBruteForce = 0
const MaxBruteForce = 64
MaxLen 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 int
PrimeRK is the prime base used in Rabin-Karp algorithm.
const PrimeRK = 16777619
var SupportsPower9 = cpu.PPC64.IsPOWER9
Offsets into internal/cpu records for use in assembly.
const offsetPPC64HasPOWER9 = *ast.CallExpr
Offsets into internal/cpu records for use in assembly.
const offsetS390xHasVX = *ast.CallExpr
Offsets into internal/cpu records for use in assembly.
const offsetX86HasAVX2 = *ast.CallExpr
Offsets into internal/cpu records for use in assembly.
const offsetX86HasPOPCNT = *ast.CallExpr
Offsets into internal/cpu records for use in assembly.
const offsetX86HasSSE42 = *ast.CallExpr
go:noescape
func Compare(a []byte, b []byte) int
func Compare(a []byte, b []byte) int
func CompareString(a string, b string) int
func CompareString(a string, b string) int
func Count(b []byte, c byte) int
go:noescape
func Count(b []byte, c byte) int
go:noescape
func CountString(s string, c byte) int
func CountString(s string, c byte) int
Cutover 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) int
Cutover 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) int
Cutover 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) int
Cutover 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) int
Cutover 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) int
Equal 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) bool
HashStr 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) int
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. go:noescape
func Index(a []byte, b []byte) int
go:noescape
func IndexByte(b []byte, c byte) int
func IndexByte(b []byte, c byte) int
func IndexByteString(s string, c byte) int
go:noescape
func IndexByteString(s string, c byte) int
IndexRabinKarp 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) int
IndexString 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) int
IndexString 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) int
func LastIndexByte(s []byte, c byte) int
func LastIndexByteString(s string, c byte) int
LastIndexRabinKarp 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) int
MakeNoZero 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) []byte
go:linkname abigen_runtime_cmpstring runtime.cmpstring
func abigen_runtime_cmpstring(a string, b string) int
go:linkname abigen_runtime_memequal runtime.memequal
func abigen_runtime_memequal(a unsafe.Pointer, b unsafe.Pointer, size uintptr) bool
go:linkname abigen_runtime_memequal_varlen runtime.memequal_varlen
func abigen_runtime_memequal_varlen(a unsafe.Pointer, b unsafe.Pointer) bool
A backup implementation to use by assembly.
func countGeneric(b []byte, c byte) int
func countGenericString(s string, c byte) int
func 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) int
Generated with Arrow