@@ -1765,7 +1765,7 @@ fn simd_contains(needle: &str, haystack: &str) -> Option<bool> {
1765
1765
} ;
1766
1766
1767
1767
// 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 {
1769
1769
return Some ( haystack. windows ( needle. len ( ) ) . any ( |c| c == needle) ) ;
1770
1770
}
1771
1771
@@ -1812,7 +1812,7 @@ fn simd_contains(needle: &str, haystack: &str) -> Option<bool> {
1812
1812
let eq_first: Mask = a. simd_eq ( first_probe) ;
1813
1813
let eq_last: Mask = b. simd_eq ( second_probe) ;
1814
1814
let both = eq_first. bitand ( eq_last) ;
1815
- let mask = both. to_bitmask ( ) ;
1815
+ let mask = both. to_bitmask ( ) as u16 ;
1816
1816
1817
1817
return mask;
1818
1818
} ;
@@ -1822,32 +1822,32 @@ fn simd_contains(needle: &str, haystack: &str) -> Option<bool> {
1822
1822
// The loop condition must ensure that there's enough headroom to read LANE bytes,
1823
1823
// and not only at the current index but also at the index shifted by block_offset
1824
1824
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 {
1826
1826
let mut masks = [ 0u16 ; UNROLL ] ;
1827
1827
for j in 0 ..UNROLL {
1828
- masks[ j] = test_chunk ( i + j * Block :: LANES ) ;
1828
+ masks[ j] = test_chunk ( i + j * Block :: LEN ) ;
1829
1829
}
1830
1830
for j in 0 ..UNROLL {
1831
1831
let mask = masks[ j] ;
1832
1832
if mask != 0 {
1833
- result |= check_mask ( i + j * Block :: LANES , mask, result) ;
1833
+ result |= check_mask ( i + j * Block :: LEN , mask, result) ;
1834
1834
}
1835
1835
}
1836
- i += UNROLL * Block :: LANES ;
1836
+ i += UNROLL * Block :: LEN ;
1837
1837
}
1838
- while i + last_byte_offset + Block :: LANES < haystack. len ( ) && !result {
1838
+ while i + last_byte_offset + Block :: LEN < haystack. len ( ) && !result {
1839
1839
let mask = test_chunk ( i) ;
1840
1840
if mask != 0 {
1841
1841
result |= check_mask ( i, mask, result) ;
1842
1842
}
1843
- i += Block :: LANES ;
1843
+ i += Block :: LEN ;
1844
1844
}
1845
1845
1846
1846
// Process the tail that didn't fit into LANES-sized steps.
1847
1847
// This simply repeats the same procedure but as right-aligned chunk instead
1848
1848
// of a left-aligned one. The last byte must be exactly flush with the string end so
1849
1849
// 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 ;
1851
1851
let mask = test_chunk ( i) ;
1852
1852
if mask != 0 {
1853
1853
result |= check_mask ( i, mask, result) ;
0 commit comments