Lines Matching defs:shift
43 /// 4) If a mismatch occurs, shift the search by some amount based on the
44 /// critical position and a pre-computed shift.
56 /// position (the length of the needle). This is essentially the shift
72 /// The amount we shift by in the Two-Way search algorithm. This
74 shift: Shift,
94 let shift = Shift::forward(needle, period_lower_bound, critical_pos);
95 Forward(TwoWay { byteset, critical_pos, shift })
116 match self.0.shift {
120 Shift::Large { shift } => {
121 self.find_large_imp(pre, haystack, needle, shift)
161 let mut shift = 0;
163 let mut i = cmp::max(self.0.critical_pos, shift);
167 shift = 0;
176 shift = 0;
184 shift = 0;
187 while j > shift && needle[j] == haystack[pos + j] {
190 if j <= shift && needle[shift] == haystack[pos + shift] {
194 shift = needle.len() - period;
206 shift: usize,
233 pos += shift;
262 let shift = Shift::reverse(needle, period_lower_bound, critical_pos);
263 Reverse(TwoWay { byteset, critical_pos, shift })
286 match self.0.shift {
290 Shift::Large { shift } => {
291 self.rfind_large_imp(haystack, needle, shift)
319 let mut shift = nlen;
323 shift = nlen;
326 let mut i = cmp::min(self.0.critical_pos, shift);
332 shift = nlen;
335 while j < shift && needle[j] == haystack[pos - nlen + j] {
338 if j >= shift {
342 shift = period;
353 shift: usize,
376 pos -= shift;
388 shift: Shift::Large { shift: 0 },
393 /// A representation of the amount we're allowed to shift by during Two-Way
412 /// length. In this case, we shift by an amount less than or equal to the
426 Large { shift: usize },
430 /// Compute the shift for a given needle in the forward direction.
443 return Shift::Large { shift: large };
448 return Shift::Large { shift: large };
453 /// Compute the shift for a given needle in the reverse direction.
466 return Shift::Large { shift: large };
471 return Shift::Large { shift: large };
869 // == shift' to determine if a match occurred, but the correct guard is 'if
870 // j >= shift', which matches the corresponding guard in the forward impl.