Skip to content

Commit

Permalink
shorter version
Browse files Browse the repository at this point in the history
  • Loading branch information
LaihoE committed Oct 5, 2024
1 parent 2ef2b3e commit a37f649
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions library/core/src/slice/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,8 @@ macro_rules! impl_slice_contains {
// Make our LANE_COUNT 4x the normal lane count. The compiler will nicely unroll it.
const LANE_COUNT: usize = 4 * (128 / (mem::size_of::<$t>() * 8));
// SIMD
let mut matches = [false; LANE_COUNT];
for chunk in arr.chunks_exact(LANE_COUNT){
matches.iter_mut().zip(chunk).for_each(|(m, x)| *m = *x == *self);
if matches.iter().fold(false, |acc, x| acc | x) {
if chunk.iter().fold(false, |acc, x| acc | (*x == needle)) {
return true;
}
}
Expand Down

0 comments on commit a37f649

Please sign in to comment.