/third_party/rust/crates/memchr/src/memchr/ |
H A D | mod.rs | 15 /// An iterator over all occurrences of the needle in a haystack. 17 pub fn memchr_iter(needle: u8, haystack: &[u8]) -> Memchr<'_> { in memchr_iter() 18 Memchr::new(needle, haystack) in memchr_iter() 21 /// An iterator over all occurrences of the needles in a haystack. in memchr_iter() 23 pub fn memchr2_iter(needle1: u8, needle2: u8, haystack: &[u8]) -> Memchr2<'_> { in memchr_iter() 24 Memchr2::new(needle1, needle2, haystack) in memchr_iter() 27 /// An iterator over all occurrences of the needles in a haystack. in memchr_iter() 33 haystack: &[u8], in memchr_iter() 35 Memchr3::new(needle1, needle2, needle3, haystack) in memchr_iter() 38 /// An iterator over all occurrences of the needle in a haystack, i in memchr_iter() [all...] |
H A D | naive.rs | 3 pub fn memchr(n1: u8, haystack: &[u8]) -> Option<usize> { in memchr() 4 haystack.iter().position(|&b| b == n1) in memchr() 7 pub fn memchr2(n1: u8, n2: u8, haystack: &[u8]) -> Option<usize> { in memchr2() 8 haystack.iter().position(|&b| b == n1 || b == n2) in memchr2() 11 pub fn memchr3(n1: u8, n2: u8, n3: u8, haystack: &[u8]) -> Option<usize> { in memchr3() 12 haystack.iter().position(|&b| b == n1 || b == n2 || b == n3) in memchr3() 15 pub fn memrchr(n1: u8, haystack: &[u8]) -> Option<usize> { in memrchr() 16 haystack.iter().rposition(|&b| b == n1) in memrchr() 19 pub fn memrchr2(n1: u8, n2: u8, haystack: &[u8]) -> Option<usize> { in memrchr2() 20 haystack in memrchr2() [all...] |
H A D | iter.rs | 5 // update haystack and position and produce the index 15 $self_.haystack = $self_.haystack.split_at(index + 1).1; 27 $self_.haystack = $self_.haystack.split_at(index).0; 36 // The haystack to iterate over 37 haystack: &'a [u8], 43 /// Creates a new iterator that yields all positions of needle in haystack. 45 pub fn new(needle: u8, haystack: &[u8]) -> Memchr<'_> { in new() 46 Memchr { needle: needle, haystack in new() [all...] |
H A D | c.rs | 8 pub fn memchr(needle: u8, haystack: &[u8]) -> Option<usize> { in memchr() 12 haystack.as_ptr() as *const c_void, in memchr() 14 haystack.len() as size_t, in memchr() 20 Some(p as usize - (haystack.as_ptr() as usize)) in memchr() 26 pub fn memrchr(needle: u8, haystack: &[u8]) -> Option<usize> { in memrchr() 27 // GNU's memrchr() will - unlike memchr() - error if haystack is empty. in memrchr() 28 if haystack.is_empty() { in memrchr() 34 haystack.as_ptr() as *const c_void, in memrchr() 36 haystack.len() as size_t, in memrchr() 42 Some(p as usize - (haystack in memrchr() [all...] |
H A D | fallback.rs | 46 pub fn memchr(n1: u8, haystack: &[u8]) -> Option<usize> { in memchr() 49 let loop_size = cmp::min(LOOP_SIZE, haystack.len()); in memchr() 51 let start_ptr = haystack.as_ptr(); in memchr() 55 let end_ptr = start_ptr.add(haystack.len()); in memchr() 56 if haystack.len() < USIZE_BYTES { in memchr() 85 pub fn memchr2(n1: u8, n2: u8, haystack: &[u8]) -> Option<usize> { in memchr2() 90 let start_ptr = haystack.as_ptr(); in memchr2() 94 let end_ptr = start_ptr.add(haystack.len()); in memchr2() 95 if haystack.len() < USIZE_BYTES { in memchr2() 125 pub fn memchr3(n1: u8, n2: u8, n3: u8, haystack [all...] |
/third_party/rust/crates/aho-corasick/src/packed/teddy/ |
H A D | runtime.rs | 13 // while at <= len(haystack) - CHUNK_SIZE: 14 // let candidate = find_candidate_in_chunk(haystack, at) 16 // if match = verify(haystack, at, candidate): 27 // of the haystack, which is always 16 or 32 bytes). Note to be careful here: 37 // forward: you just apply the shuffle indices (from the haystack window) to 95 /// Return the first occurrence of a match in the given haystack after or 106 haystack: &[u8], in find_at() 123 // SAFETY: The haystack must have at least a minimum number of bytes in find_at() 127 assert!(haystack[at..].len() >= self.minimum_len()); in find_at() 138 e.find_at(pats, self, haystack, a in find_at() [all...] |
/third_party/rust/crates/memchr/bench/src/memchr/ |
H A D | imp.rs | 5 pub fn memchr1_count(b1: u8, haystack: &[u8]) -> usize { in memchr1_count() 6 Memchr::new(b1, haystack).count() in memchr1_count() 9 pub fn memchr1_libc_count(b1: u8, haystack: &[u8]) -> usize { in memchr1_libc_count() 12 while let Some(i) = c::memchr(b1, &haystack[start..]) { in memchr1_libc_count() 19 pub fn fallback1_count(b1: u8, haystack: &[u8]) -> usize { in fallback1_count() 22 while let Some(i) = fallback::memchr(b1, &haystack[start..]) { in fallback1_count() 29 pub fn naive1_count(b1: u8, haystack: &[u8]) -> usize { in naive1_count() 32 while let Some(i) = naive::memchr(b1, &haystack[start..]) { in naive1_count() 39 pub fn memchr2_count(b1: u8, b2: u8, haystack: &[u8]) -> usize { in memchr2_count() 40 Memchr2::new(b1, b2, haystack) in memchr2_count() [all...] |
/third_party/rust/crates/memchr/src/memmem/ |
H A D | rabinkarp.rs | 7 to compute a needle hash and zip through the haystack when compared to 9 where the haystack is just too short for vector instructions to do much good. 34 /// Whether RK is believed to be very fast for the given needle/haystack. 35 pub(crate) fn is_fast(haystack: &[u8], _needle: &[u8]) -> bool { 36 haystack.len() < 16 39 /// Search for the first occurrence of needle in haystack using Rabin-Karp. 40 pub(crate) fn find(haystack: &[u8], needle: &[u8]) -> Option<usize> { 41 find_with(&NeedleHash::forward(needle), haystack, needle) 44 /// Search for the first occurrence of needle in haystack using Rabin-Karp with 48 mut haystack [all...] |
H A D | mod.rs | 17 in a haystack. 22 let haystack = b"foo bar foo baz foo"; 24 let mut it = memmem::find_iter(haystack, "foo"); 34 in a haystack starting from the end of the haystack. 42 let haystack = b"foo bar foo baz foo"; 44 let mut it = memmem::rfind_iter(haystack, "foo"); 102 haystack: Vec<u8>, in qc_fwd_matches_naive() 105 proptests::matches_naive(false, &haystack, &needle, $fwd) in qc_fwd_matches_naive() 117 haystack in qc_rev_matches_naive() [all...] |
H A D | twoway.rs | 18 /// `n ~ len(needle)` and `m ~ len(haystack)`. 40 /// 2) For the current position in the haystack, look if needle[critical..] 79 /// through any haystack. 99 /// the given haystack. If one does not exist, then return None. 105 /// <= the haystack's length. 110 haystack: &[u8], 114 debug_assert!(needle.len() <= haystack.len(), "haystack too short"); 118 self.find_small_imp(pre, haystack, needle, period) 121 self.find_large_imp(pre, haystack, needl [all...] |
/third_party/ffmpeg/libavutil/tests/ |
H A D | avstring.c | 57 const char *haystack = "Education consists mainly in what we have unlearned."; in main() local 86 #define TEST_STRNSTR(haystack, needle, hay_length, expected) \ in main() 87 ptr = av_strnstr(haystack, needle, hay_length); \ in main() 91 TEST_STRNSTR(haystack, needle [0], strlen(haystack), haystack+44); in main() 92 TEST_STRNSTR(haystack, needle [1], strlen(haystack), haystack+42); in main() 93 TEST_STRNSTR(haystack, needl in main() [all...] |
/third_party/rust/crates/memchr/bench/src/memmem/ |
H A D | imp.rs | 29 pub(crate) fn oneshot(haystack: &str, needle: &str) -> bool { 30 memmem::find(haystack.as_bytes(), needle.as_bytes()).is_some() 41 haystack: &'a str, 44 memmem::find_iter(haystack.as_bytes(), needle.as_bytes()) 57 haystack: &'a str, 59 self.0.find_iter(haystack.as_bytes()) 67 pub(crate) fn oneshot(haystack: &str, needle: &str) -> bool { 68 memmem::rfind(haystack.as_bytes(), needle.as_bytes()).is_some() 79 haystack: &'a str, 82 memmem::rfind_iter(haystack [all...] |
H A D | sliceslice.rs | 17 a longer haystack with common English words. 21 specific needle with one specific haystack, and each iteration is a single 54 for haystack in &needles[i..] { in search_short_haystack() 56 searcher.find(haystack.as_bytes()).is_some(), in search_short_haystack() 80 for haystack in &needles[i..] { in search_short_haystack() 82 searcher.find(haystack.as_bytes()).is_some(), in search_short_haystack() 98 for haystack in &needles[i..] { in search_short_haystack() 99 black_box(haystack.contains(needle)); in search_short_haystack() 125 for haystack in &needles[i..] { in search_short_haystack() 127 searcher.search_in(haystack in search_short_haystack() [all...] |
/third_party/rust/crates/memchr/src/memchr/x86/ |
H A D | mod.rs | 36 ($fnty:ty, $name:ident, $haystack:ident, $($needle:ident),+) => {{ 43 fn detect($($needle: u8),+, haystack: &[u8]) -> Option<usize> { in detect() 58 mem::transmute::<FnRaw, $fnty>(fun)($($needle),+, haystack) in detect() 68 mem::transmute::<FnRaw, $fnty>(fun)($($needle),+, $haystack) 85 ($fnty:ty, $name:ident, $haystack:ident, $($needle:ident),+) => {{ 87 unsafe { sse2::$name($($needle),+, $haystack) } 89 fallback::$name($($needle),+, $haystack) 95 pub fn memchr(n1: u8, haystack: &[u8]) -> Option<usize> { in memchr() 96 unsafe_ifunc!(fn(u8, &[u8]) -> Option<usize>, memchr, haystack, n1) in memchr() 100 pub fn memchr2(n1: u8, n2: u8, haystack [all...] |
/third_party/rust/crates/aho-corasick/src/ |
H A D | automaton.rs | 188 haystack: &[u8], in standard_find_at() 196 haystack, in standard_find_at() 201 self.standard_find_at_imp(prestate, None, haystack, at, state_id) in standard_find_at() 213 haystack: &[u8], in standard_find_at_imp() 217 while at < haystack.len() { in standard_find_at_imp() 221 let c = prefilter::next(prestate, pre, haystack, at) in standard_find_at_imp() 236 *state_id = self.next_state_no_fail(*state_id, haystack[at]); in standard_find_at_imp() 265 /// is found, the search does not stop until either the haystack has been 273 haystack: &[u8], in leftmost_find_at() 281 haystack, in leftmost_find_at() [all...] |
H A D | ahocorasick.rs | 56 /// let haystack = "Nobody likes maple in their apple flavored Snapple."; 62 /// for mat in ac.find_iter(haystack) { 78 /// let haystack = "The quick brown fox."; 82 /// let result = ac.replace_all(haystack, replace_with); 163 /// Returns true if and only if this automaton matches the haystack at any 166 /// `haystack` may be any type that is cheaply convertible to a `&[u8]`. 183 pub fn is_match<B: AsRef<[u8]>>(&self, haystack: B) -> bool { in is_match() 184 self.earliest_find(haystack).is_some() in is_match() 187 /// Returns the location of the first detected match in `haystack`. 193 /// `haystack` ma [all...] |
/third_party/rust/crates/aho-corasick/bench/src/ |
H A D | random.rs | 92 |ac, haystack| ac.find_iter(haystack).count(), in many_patterns() 103 |ac, haystack| ac.find_iter(haystack).count(), in many_patterns() 114 |ac, haystack| ac.find_iter(haystack).count(), in many_patterns() 126 |ac, haystack| ac.find_overlapping_iter(haystack).count(), in many_patterns() 140 |ac, haystack| ac.find_iter(haystack) in many_patterns() [all...] |
/third_party/typescript/tests/baselines/reference/ |
H A D | controlFlowPropertyDeclarations.js | 47 * @param {string} haystack String to search in 51 function endsWith(haystack, needle) { 52 return haystack.slice(-needle.length) === needle; 59 * @param {string} haystack String to search in 63 function trimEnd(haystack, needle) { 64 return endsWith(haystack, needle) 65 ? haystack.slice(0, -needle.length) 66 : haystack; 195 * @param {string} haystack String to search in
199 function endsWith(haystack, needl [all...] |
/third_party/backends/lib/ |
H A D | strcasestr.c | 44 register const unsigned char *haystack, *needle; in strcasestr() local 47 haystack = (const unsigned char *) phaystack; in strcasestr() 52 haystack--; /* possible ANSI violation */ in strcasestr() 54 c = *++haystack; in strcasestr() 71 a = *++haystack; in strcasestr() 76 a = *++haystack; in strcasestr() 82 jin:a = *++haystack; in strcasestr() 89 rhaystack = haystack-- + 1; in strcasestr() 115 return (char *) haystack; in strcasestr()
|
/third_party/rust/crates/aho-corasick/src/packed/ |
H A D | api.rs | 424 /// according to its match semantics, in the given haystack. The `Match` 449 pub fn find<B: AsRef<[u8]>>(&self, haystack: B) -> Option<Match> { in find() 450 self.find_at(haystack, 0) in find() 454 /// according to its match semantics, in the given haystack starting from 460 /// to the start of `haystack` (and not `at`). 484 haystack: B, in find_at() 487 let haystack = haystack.as_ref(); in find_at() 490 if haystack[at..].len() < teddy.minimum_len() { in find_at() 491 return self.slow_at(haystack, a in find_at() [all...] |
/third_party/skia/third_party/externals/abseil-cpp/absl/strings/internal/ |
H A D | memutil.h | 89 const char* int_memmatch(const char* haystack, size_t haylen, in int_memmatch() argument 92 return haystack; // even if haylen is 0 in int_memmatch() 94 const char* hayend = haystack + haylen; in int_memmatch() 98 for (; haystack < hayend; ++haystack) { in int_memmatch() 100 ? *haystack in int_memmatch() 101 : absl::ascii_tolower(static_cast<unsigned char>(*haystack)); in int_memmatch() 107 return haystack + 1 - neelen; in int_memmatch() 110 // must back up haystack in case a prefix matched (find "aab" in "aaab") in int_memmatch() 111 haystack in int_memmatch() [all...] |
/third_party/rust/crates/regex/bench/src/ |
H A D | bench.rs | 48 // Usage: text!(haystack) 88 // USAGE: bench_match!(name, pattern, haystack) 91 // a particular haystack. If the regex doesn't match, then the benchmark fails. 98 // haystack should be a String. 100 ($name:ident, $pattern:expr, $haystack:expr) => { 101 bench_is_match!($name, true, regex!($pattern), $haystack); 105 // USAGE: bench_not_match!(name, pattern, haystack) 108 // a particular haystack. If the regex matches, then the benchmark fails. 115 // haystack should be a String. 117 ($name:ident, $pattern:expr, $haystack [all...] |
/third_party/rust/crates/memchr/src/memmem/x86/ |
H A D | avx.rs | 30 /// Returns the minimum length of haystack that is needed for this 31 /// searcher to work. Passing a haystack with a length smaller than 41 haystack: &[u8], 47 unsafe { self.find_impl(haystack, needle) } 60 haystack: &[u8], in find_impl() 63 if haystack.len() < self.0.min_haystack_len::<__m256i>() { in find_impl() 64 genericsimd::fwd_find::<__m128i>(&self.0, haystack, needle) in find_impl() 66 genericsimd::fwd_find::<__m256i>(&self.0, haystack, needle) in find_impl() 95 haystack: &[u8], 110 haystack in find() [all...] |
/third_party/rust/crates/regex/src/ |
H A D | find_byte.rs | 1 /// Searches for the given needle in the given haystack. 5 pub fn find_byte(needle: u8, haystack: &[u8]) -> Option<usize> { in find_byte() 7 fn imp(needle: u8, haystack: &[u8]) -> Option<usize> { in find_byte() 8 haystack.iter().position(|&b| b == needle) in find_byte() 12 fn imp(needle: u8, haystack: &[u8]) -> Option<usize> { in find_byte() 14 memchr(needle, haystack) in find_byte() 17 imp(needle, haystack) in find_byte()
|
/third_party/rust/crates/regex/tests/ |
H A D | searcher.rs | 2 ($name:ident, $re:expr, $haystack:expr) => ( 3 searcher!($name, $re, $haystack, vec vec![]); 5 ($name:ident, $re:expr, $haystack:expr, $($steps:expr,)*) => ( 6 searcher!($name, $re, $haystack, vec vec![$($steps),*]); 8 ($name:ident, $re:expr, $haystack:expr, $($steps:expr),*) => ( 9 searcher!($name, $re, $haystack, vec vec![$($steps),*]); 11 ($name:ident, $re:expr, $haystack:expr, vec $expect_steps:expr) => ( 19 let mut se = re.into_searcher($haystack);
|