File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 11#![ cfg( feature = "alloc" ) ]
22
33#[ cfg( feature = "experimental" ) ]
4- use core:: simd:: Simd ;
4+ use core:: simd:: {
5+ cmp:: SimdPartialEq ,
6+ Simd ,
7+ } ;
58
69use super :: {
710 internal:: inc_pc,
@@ -1045,16 +1048,16 @@ fn slice_eq(a: &[u8], b: &[u8]) -> bool {
10451048 let mut i = 0 ;
10461049
10471050 // Process chunks of 64 bytes
1051+ #[ cfg( target_feature = "avx512f" ) ]
10481052 while i + 64 <= len {
10491053 let chunk_a = Simd :: < u8 , 64 > :: from_slice ( & a[ i..] ) ;
10501054 let chunk_b = Simd :: < u8 , 64 > :: from_slice ( & b[ i..] ) ;
1051- if chunk_a != chunk_b {
1052- return false ;
1053- }
1055+ chunk_a. simd_eq ( chunk_b) . all_true ( ) ;
10541056 i += 64 ;
10551057 }
10561058
10571059 // Process chunks of 32 bytes
1060+ #[ cfg( target_feature = "avx2" ) ]
10581061 while i + 32 <= len {
10591062 let chunk_a = Simd :: < u8 , 32 > :: from_slice ( & a[ i..] ) ;
10601063 let chunk_b = Simd :: < u8 , 32 > :: from_slice ( & b[ i..] ) ;
You can’t perform that action at this time.
0 commit comments