Lines Matching refs:needle
5 /// The minimum length of a needle required for this algorithm. The minimum
10 /// The maximum length of a needle required for this algorithm.
13 /// length needle. (Perhaps that suggests there are missing optimizations.)
22 /// in the size of the needle and haystack, and we want to keep that additive.
29 /// The rare-medium-needle, for example, gets about 5% faster by using this
43 /// needle is very quick, even on pathological inputs. This is much better than
64 pub(crate) fn new(ninfo: &NeedleInfo, needle: &[u8]) -> Option<Forward> {
66 // If the needle is too short or too long, give up. Also, give up
70 if needle.len() < MIN_NEEDLE_LEN
71 || needle.len() > MAX_NEEDLE_LEN
88 /// Searches the given haystack for the given needle. The needle given should
89 /// be the same as the needle that this searcher was initialized with.
106 needle: &[u8],
110 // guarantee that end_ptr.sub(needle.len()) won't result in UB. We could
113 if haystack.len() < needle.len() {
118 debug_assert!(needle.len() <= haystack.len());
120 needle.len() >= MIN_NEEDLE_LEN,
121 "needle must be at least {} bytes",
125 needle.len() <= MAX_NEEDLE_LEN,
126 "needle must be at most {} bytes",
131 let rare1chunk = V::splat(needle[rare1i]);
132 let rare2chunk = V::splat(needle[rare2i]);
146 fwd, needle, ptr, end_ptr, rare1chunk, rare2chunk, !0,
162 if remaining < needle.len() {
188 fwd, needle, ptr, end_ptr, rare1chunk, rare2chunk, mask,
197 /// Search for an occurrence of two rare bytes from the needle in the chunk
215 /// loads on ptr up to (end_ptr - needle.len()).
219 needle: &[u8],
236 if end_ptr.sub(needle.len()) < ptr {
239 let chunk = core::slice::from_raw_parts(ptr, needle.len());
240 if memcmp(needle, chunk) {