@@ -8,17 +8,17 @@ pub const MAX_DEGREE: usize = 4;
88#[ cfg( not( any( target_arch = "x86" , target_arch = "x86_64" ) ) ) ]
99pub const MAX_DEGREE : usize = 1 ;
1010
11- // Variants other than Portable are unreachable in no_std, unless CPU features
12- // are explicitly enabled for the build with e.g. RUSTFLAGS="-C target-feature=avx2".
13- // This might change in the future if is_x86_feature_detected moves into libcore.
11+ /// Variants other than Portable are unreachable in no_std, unless CPU features
12+ /// are explicitly enabled for the build with e.g. RUSTFLAGS="-C target-feature=avx2".
13+ /// This might change in the future if is_x86_feature_detected moves into libcore.
1414#[ allow( dead_code) ]
1515#[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
1616enum Platform {
1717 Portable ,
1818 #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
19- SSE41 ,
19+ Sse41 ,
2020 #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
21- AVX2 ,
21+ Avx2 ,
2222}
2323
2424#[ derive( Clone , Copy , Debug ) ]
@@ -53,13 +53,13 @@ impl Implementation {
5353 // Check whether SSE4.1 support is assumed by the build.
5454 #[ cfg( target_feature = "sse4.1" ) ]
5555 {
56- return Some ( Implementation ( Platform :: SSE41 ) ) ;
56+ return Some ( Implementation ( Platform :: Sse41 ) ) ;
5757 }
5858 // Otherwise dynamically check for support if we can.
5959 #[ cfg( feature = "std" ) ]
6060 {
6161 if is_x86_feature_detected ! ( "sse4.1" ) {
62- return Some ( Implementation ( Platform :: SSE41 ) ) ;
62+ return Some ( Implementation ( Platform :: Sse41 ) ) ;
6363 }
6464 }
6565 None
@@ -71,13 +71,13 @@ impl Implementation {
7171 // Check whether AVX2 support is assumed by the build.
7272 #[ cfg( target_feature = "avx2" ) ]
7373 {
74- return Some ( Implementation ( Platform :: AVX2 ) ) ;
74+ return Some ( Implementation ( Platform :: Avx2 ) ) ;
7575 }
7676 // Otherwise dynamically check for support if we can.
7777 #[ cfg( feature = "std" ) ]
7878 {
7979 if is_x86_feature_detected ! ( "avx2" ) {
80- return Some ( Implementation ( Platform :: AVX2 ) ) ;
80+ return Some ( Implementation ( Platform :: Avx2 ) ) ;
8181 }
8282 }
8383 None
@@ -86,9 +86,9 @@ impl Implementation {
8686 pub fn degree ( & self ) -> usize {
8787 match self . 0 {
8888 #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
89- Platform :: AVX2 => avx2:: DEGREE ,
89+ Platform :: Avx2 => avx2:: DEGREE ,
9090 #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
91- Platform :: SSE41 => sse41:: DEGREE ,
91+ Platform :: Sse41 => sse41:: DEGREE ,
9292 Platform :: Portable => 1 ,
9393 }
9494 }
@@ -104,7 +104,7 @@ impl Implementation {
104104 ) {
105105 match self . 0 {
106106 #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
107- Platform :: AVX2 => unsafe {
107+ Platform :: Avx2 => unsafe {
108108 avx2:: compress1_loop ( input, words, count, last_node, finalize, stride) ;
109109 } ,
110110 // Note that there's an SSE version of compress1 in the official C
@@ -118,7 +118,7 @@ impl Implementation {
118118 pub fn compress2_loop ( & self , jobs : & mut [ Job < ' _ , ' _ > ; 2 ] , finalize : Finalize , stride : Stride ) {
119119 match self . 0 {
120120 #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
121- Platform :: AVX2 | Platform :: SSE41 => unsafe {
121+ Platform :: Avx2 | Platform :: Sse41 => unsafe {
122122 sse41:: compress2_loop ( jobs, finalize, stride)
123123 } ,
124124 _ => panic ! ( "unsupported" ) ,
@@ -128,7 +128,7 @@ impl Implementation {
128128 pub fn compress4_loop ( & self , jobs : & mut [ Job < ' _ , ' _ > ; 4 ] , finalize : Finalize , stride : Stride ) {
129129 match self . 0 {
130130 #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
131- Platform :: AVX2 => unsafe { avx2:: compress4_loop ( jobs, finalize, stride) } ,
131+ Platform :: Avx2 => unsafe { avx2:: compress4_loop ( jobs, finalize, stride) } ,
132132 _ => panic ! ( "unsupported" ) ,
133133 }
134134 }
@@ -271,20 +271,20 @@ mod test {
271271 #[ cfg( feature = "std" ) ]
272272 {
273273 if is_x86_feature_detected ! ( "avx2" ) {
274- assert_eq ! ( Platform :: AVX2 , Implementation :: detect( ) . 0 ) ;
274+ assert_eq ! ( Platform :: Avx2 , Implementation :: detect( ) . 0 ) ;
275275 assert_eq ! (
276- Platform :: AVX2 ,
276+ Platform :: Avx2 ,
277277 Implementation :: avx2_if_supported( ) . unwrap( ) . 0
278278 ) ;
279279 assert_eq ! (
280- Platform :: SSE41 ,
280+ Platform :: Sse41 ,
281281 Implementation :: sse41_if_supported( ) . unwrap( ) . 0
282282 ) ;
283283 } else if is_x86_feature_detected ! ( "sse4.1" ) {
284- assert_eq ! ( Platform :: SSE41 , Implementation :: detect( ) . 0 ) ;
284+ assert_eq ! ( Platform :: Sse41 , Implementation :: detect( ) . 0 ) ;
285285 assert ! ( Implementation :: avx2_if_supported( ) . is_none( ) ) ;
286286 assert_eq ! (
287- Platform :: SSE41 ,
287+ Platform :: Sse41 ,
288288 Implementation :: sse41_if_supported( ) . unwrap( ) . 0
289289 ) ;
290290 } else {
@@ -302,9 +302,9 @@ mod test {
302302 {
303303 // Chose counts to hit the relevant overflow cases.
304304 let counts = & [
305- ( 0 as Count ) ,
306- ( ( 1 as Count ) << ( 8 * size_of :: < Word > ( ) ) ) - BLOCKBYTES as Count ,
307- ( 0 as Count ) . wrapping_sub ( BLOCKBYTES as Count ) ,
305+ 0_u128 ,
306+ ( 1_u128 << ( 8 * size_of :: < Word > ( ) ) ) - BLOCKBYTES as Count ,
307+ 0_u128 . wrapping_sub ( BLOCKBYTES as Count ) ,
308308 ] ;
309309 for & stride in & [ Stride :: Serial , Stride :: Parallel ] {
310310 let lengths = [
0 commit comments