Home | History | Annotate | Download | only in bytes

Lines Matching refs:sep

9 // indexShortStr returns the index of the first instance of sep in s,
10 // or -1 if sep is not present in s.
11 // indexShortStr requires 2 <= len(sep) <= shortStringLen
27 // Index returns the index of the first instance of sep in s, or -1 if sep is not present in s.
28 func Index(s, sep []byte) int {
29 n := len(sep)
34 return IndexByte(s, sep[0])
36 if Equal(sep, s) {
43 // Use brute force when s and sep both are small
45 return indexShortStr(s, sep)
47 c := sep[0]
61 if Equal(s[i:i+n], sep) {
70 r := indexShortStr(s[i:], sep)
80 hashsep, pow := hashStr(sep)
85 if h == hashsep && Equal(s[:n], sep) {
93 if h == hashsep && Equal(s[i-n:i], sep) {
105 func hashStr(sep []byte) (uint32, uint32) {
107 for i := 0; i < len(sep); i++ {
108 hash = hash*primeRK + uint32(sep[i])
111 for i := len(sep); i > 0; i >>= 1 {