Lines Matching refs:k
29 twobyte_memmem(const unsigned char *h, size_t k, const unsigned char *n) in twobyte_memmem() argument
32 for (h += 2, k -= 2; k; k--, hw = hw << 8 | *h++) in twobyte_memmem()
39 threebyte_memmem(const unsigned char *h, size_t k, const unsigned char *n) in threebyte_memmem() argument
43 for (h += 3, k -= 3; k; k--, hw = (hw | *h++) << 8) in threebyte_memmem()
50 fourbyte_memmem(const unsigned char *h, size_t k, const unsigned char *n) in fourbyte_memmem() argument
54 for (h += 4, k -= 4; k; k--, hw = hw << 8 | *h++) in fourbyte_memmem()
79 size_t i, ip, jp, k, p, ms, p0, mem, mem0; in twoway_memmem() local
90 k = p = 1; in twoway_memmem()
91 while (jp + k < l) { in twoway_memmem()
92 if (n[ip + k] == n[jp + k]) { in twoway_memmem()
93 if (k == p) { in twoway_memmem()
95 k = 1; in twoway_memmem()
97 k++; in twoway_memmem()
98 } else if (n[ip + k] > n[jp + k]) { in twoway_memmem()
99 jp += k; in twoway_memmem()
100 k = 1; in twoway_memmem()
104 k = p = 1; in twoway_memmem()
113 k = p = 1; in twoway_memmem()
114 while (jp + k < l) { in twoway_memmem()
115 if (n[ip + k] == n[jp + k]) { in twoway_memmem()
116 if (k == p) { in twoway_memmem()
118 k = 1; in twoway_memmem()
120 k++; in twoway_memmem()
121 } else if (n[ip + k] < n[jp + k]) { in twoway_memmem()
122 jp += k; in twoway_memmem()
123 k = 1; in twoway_memmem()
127 k = p = 1; in twoway_memmem()
151 k = l - shift[h[l - 1]]; in twoway_memmem()
152 if (k) { in twoway_memmem()
153 if (k < mem) in twoway_memmem()
154 k = mem; in twoway_memmem()
155 h += k; in twoway_memmem()
166 for (k = MAX(ms + 1, mem); k < l && n[k] == h[k]; k++) in twoway_memmem()
168 if (k < l) { in twoway_memmem()
169 h += k - ms; in twoway_memmem()
174 for (k = ms + 1; k > mem && n[k - 1] == h[k - 1]; k--) in twoway_memmem()
176 if (k <= mem) in twoway_memmem()
184 memmem(const void *h0, size_t k, const void *n0, size_t l) in memmem() argument
193 if (k < l) in memmem()
197 h = memchr(h0, *n, k); in memmem()
200 k -= h - (const unsigned char *)h0; in memmem()
201 if (k < l) in memmem()
204 return twobyte_memmem(h, k, n); in memmem()
206 return threebyte_memmem(h, k, n); in memmem()
208 return fourbyte_memmem(h, k, n); in memmem()
210 return twoway_memmem(h, h + k, n, l); in memmem()