File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -213,18 +213,15 @@ unsafe fn find_bytes_sse2(haystack: &[u8], needle: &[u8]) -> Option<usize> {
213213
214214 while pos + needle_len <= haystack_len {
215215 // Find the next occurrence of the first byte
216- if let Some ( offset) = find_byte_sse2 ( & haystack[ pos..] , first_byte) {
217- let candidate_pos = pos + offset;
218-
219- // Check if the rest matches
220- if candidate_pos + needle_len <= haystack_len {
221- if eq_bytes_sse2 ( & haystack[ candidate_pos..candidate_pos + needle_len] , needle) {
222- return Some ( candidate_pos) ;
223- }
224- pos = candidate_pos + 1 ;
225- } else {
226- return None ;
216+ let offset = find_byte_sse2 ( & haystack[ pos..] , first_byte) ?;
217+ let candidate_pos = pos + offset;
218+
219+ // Check if the rest matches
220+ if candidate_pos + needle_len <= haystack_len {
221+ if eq_bytes_sse2 ( & haystack[ candidate_pos..candidate_pos + needle_len] , needle) {
222+ return Some ( candidate_pos) ;
227223 }
224+ pos = candidate_pos + 1 ;
228225 } else {
229226 return None ;
230227 }
You can’t perform that action at this time.
0 commit comments