bytealg

Imports

Imports #

_ "unsafe"
"unsafe"
"internal/cpu"
"unsafe"
_ "unsafe"
"internal/cpu"
"internal/cpu"
"internal/cpu"

Constants & Variables

MaxBruteForce const #

Empirical data shows that using Index can get better performance when len(s) <= 16.

const MaxBruteForce = 16

MaxBruteForce const #

const MaxBruteForce = 16

MaxBruteForce const #

const MaxBruteForce = 64

MaxBruteForce const #

const MaxBruteForce = 0

MaxBruteForce const #

const MaxBruteForce = 64

MaxLen var #

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 const #

PrimeRK is the prime base used in Rabin-Karp algorithm.

const PrimeRK = 16777619

SupportsPower9 var #

var SupportsPower9 = cpu.PPC64.IsPOWER9

offsetPPC64HasPOWER9 const #

Offsets into internal/cpu records for use in assembly.

const offsetPPC64HasPOWER9 = *ast.CallExpr

offsetS390xHasVX const #

Offsets into internal/cpu records for use in assembly.

const offsetS390xHasVX = *ast.CallExpr

offsetX86HasAVX2 const #

Offsets into internal/cpu records for use in assembly.

const offsetX86HasAVX2 = *ast.CallExpr

offsetX86HasPOPCNT const #

Offsets into internal/cpu records for use in assembly.

const offsetX86HasPOPCNT = *ast.CallExpr

offsetX86HasSSE42 const #

Offsets into internal/cpu records for use in assembly.

const offsetX86HasSSE42 = *ast.CallExpr

Functions

Compare function #

go:noescape

func Compare(a []byte, b []byte) int

Compare function #

func Compare(a []byte, b []byte) int

CompareString function #

func CompareString(a string, b string) int

CompareString function #

func CompareString(a string, b string) int

Count function #

func Count(b []byte, c byte) int

Count function #

go:noescape

func Count(b []byte, c byte) int

CountString function #

go:noescape

func CountString(s string, c byte) int

CountString function #

func CountString(s string, c byte) int

Cutover function #

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 function #

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 function #

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 function #

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 function #

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 function #

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 function #

HashStr returns the hash and the appropriate multiplicative factor for use in Rabin-Karp algorithm.

func HashStr(sep T) (uint32, uint32)

HashStrRev function #

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 function #

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 function #

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

IndexByte function #

go:noescape

func IndexByte(b []byte, c byte) int

IndexByte function #

func IndexByte(b []byte, c byte) int

IndexByteString function #

func IndexByteString(s string, c byte) int

IndexByteString function #

go:noescape

func IndexByteString(s string, c byte) int

IndexRabinKarp function #

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 function #

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 function #

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

LastIndexByte function #

func LastIndexByte(s []byte, c byte) int

LastIndexByteString function #

func LastIndexByteString(s string, c byte) int

LastIndexRabinKarp function #

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 function #

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

abigen_runtime_cmpstring function #

go:linkname abigen_runtime_cmpstring runtime.cmpstring

func abigen_runtime_cmpstring(a string, b string) int

abigen_runtime_memequal function #

go:linkname abigen_runtime_memequal runtime.memequal

func abigen_runtime_memequal(a unsafe.Pointer, b unsafe.Pointer, size uintptr) bool

abigen_runtime_memequal_varlen function #

go:linkname abigen_runtime_memequal_varlen runtime.memequal_varlen

func abigen_runtime_memequal_varlen(a unsafe.Pointer, b unsafe.Pointer) bool

countGeneric function #

A backup implementation to use by assembly.

func countGeneric(b []byte, c byte) int

countGenericString function #

func countGenericString(s string, c byte) int

init function #

func init()

init function #

func init()

init function #

func init()

init function #

func init()

runtime_cmpstring function #

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