@@ -1765,7 +1765,7 @@ fn simd_contains(needle: &str, haystack: &str) -> Option<bool> {
17651765 } ;
17661766
17671767 // do a naive search if the haystack is too small to fit
1768- if haystack. len ( ) < Block :: LANES + last_byte_offset {
1768+ if haystack. len ( ) < Block :: LEN + last_byte_offset {
17691769 return Some ( haystack. windows ( needle. len ( ) ) . any ( |c| c == needle) ) ;
17701770 }
17711771
@@ -1812,7 +1812,7 @@ fn simd_contains(needle: &str, haystack: &str) -> Option<bool> {
18121812 let eq_first: Mask = a. simd_eq ( first_probe) ;
18131813 let eq_last: Mask = b. simd_eq ( second_probe) ;
18141814 let both = eq_first. bitand ( eq_last) ;
1815- let mask = both. to_bitmask ( ) ;
1815+ let mask = both. to_bitmask ( ) as u16 ;
18161816
18171817 return mask;
18181818 } ;
@@ -1822,32 +1822,32 @@ fn simd_contains(needle: &str, haystack: &str) -> Option<bool> {
18221822 // The loop condition must ensure that there's enough headroom to read LANE bytes,
18231823 // and not only at the current index but also at the index shifted by block_offset
18241824 const UNROLL : usize = 4 ;
1825- while i + last_byte_offset + UNROLL * Block :: LANES < haystack. len ( ) && !result {
1825+ while i + last_byte_offset + UNROLL * Block :: LEN < haystack. len ( ) && !result {
18261826 let mut masks = [ 0u16 ; UNROLL ] ;
18271827 for j in 0 ..UNROLL {
1828- masks[ j] = test_chunk ( i + j * Block :: LANES ) ;
1828+ masks[ j] = test_chunk ( i + j * Block :: LEN ) ;
18291829 }
18301830 for j in 0 ..UNROLL {
18311831 let mask = masks[ j] ;
18321832 if mask != 0 {
1833- result |= check_mask ( i + j * Block :: LANES , mask, result) ;
1833+ result |= check_mask ( i + j * Block :: LEN , mask, result) ;
18341834 }
18351835 }
1836- i += UNROLL * Block :: LANES ;
1836+ i += UNROLL * Block :: LEN ;
18371837 }
1838- while i + last_byte_offset + Block :: LANES < haystack. len ( ) && !result {
1838+ while i + last_byte_offset + Block :: LEN < haystack. len ( ) && !result {
18391839 let mask = test_chunk ( i) ;
18401840 if mask != 0 {
18411841 result |= check_mask ( i, mask, result) ;
18421842 }
1843- i += Block :: LANES ;
1843+ i += Block :: LEN ;
18441844 }
18451845
18461846 // Process the tail that didn't fit into LANES-sized steps.
18471847 // This simply repeats the same procedure but as right-aligned chunk instead
18481848 // of a left-aligned one. The last byte must be exactly flush with the string end so
18491849 // we don't miss a single byte or read out of bounds.
1850- let i = haystack. len ( ) - last_byte_offset - Block :: LANES ;
1850+ let i = haystack. len ( ) - last_byte_offset - Block :: LEN ;
18511851 let mask = test_chunk ( i) ;
18521852 if mask != 0 {
18531853 result |= check_mask ( i, mask, result) ;
0 commit comments