Skip to content

Commit bc36279

Browse files
committed
shorter version
1 parent 2ef2b3e commit bc36279

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

library/core/src/slice/cmp.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,8 @@ macro_rules! impl_slice_contains {
267267
// Make our LANE_COUNT 4x the normal lane count. The compiler will nicely unroll it.
268268
const LANE_COUNT: usize = 4 * (128 / (mem::size_of::<$t>() * 8));
269269
// SIMD
270-
let mut matches = [false; LANE_COUNT];
271270
for chunk in arr.chunks_exact(LANE_COUNT){
272-
matches.iter_mut().zip(chunk).for_each(|(m, x)| *m = *x == *self);
273-
if matches.iter().fold(false, |acc, x| acc | x) {
271+
if chunk.iter().fold(false, |acc, x| acc | (*x == *self)) {
274272
return true;
275273
}
276274
}

0 commit comments

Comments
 (0)