@@ -8,17 +8,17 @@ pub const MAX_DEGREE: usize = 4;
8
8
#[ cfg( not( any( target_arch = "x86" , target_arch = "x86_64" ) ) ) ]
9
9
pub const MAX_DEGREE : usize = 1 ;
10
10
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.
14
14
#[ allow( dead_code) ]
15
15
#[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
16
16
enum Platform {
17
17
Portable ,
18
18
#[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
19
- SSE41 ,
19
+ Sse41 ,
20
20
#[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
21
- AVX2 ,
21
+ Avx2 ,
22
22
}
23
23
24
24
#[ derive( Clone , Copy , Debug ) ]
@@ -53,13 +53,13 @@ impl Implementation {
53
53
// Check whether SSE4.1 support is assumed by the build.
54
54
#[ cfg( target_feature = "sse4.1" ) ]
55
55
{
56
- return Some ( Implementation ( Platform :: SSE41 ) ) ;
56
+ return Some ( Implementation ( Platform :: Sse41 ) ) ;
57
57
}
58
58
// Otherwise dynamically check for support if we can.
59
59
#[ cfg( feature = "std" ) ]
60
60
{
61
61
if is_x86_feature_detected ! ( "sse4.1" ) {
62
- return Some ( Implementation ( Platform :: SSE41 ) ) ;
62
+ return Some ( Implementation ( Platform :: Sse41 ) ) ;
63
63
}
64
64
}
65
65
None
@@ -71,13 +71,13 @@ impl Implementation {
71
71
// Check whether AVX2 support is assumed by the build.
72
72
#[ cfg( target_feature = "avx2" ) ]
73
73
{
74
- return Some ( Implementation ( Platform :: AVX2 ) ) ;
74
+ return Some ( Implementation ( Platform :: Avx2 ) ) ;
75
75
}
76
76
// Otherwise dynamically check for support if we can.
77
77
#[ cfg( feature = "std" ) ]
78
78
{
79
79
if is_x86_feature_detected ! ( "avx2" ) {
80
- return Some ( Implementation ( Platform :: AVX2 ) ) ;
80
+ return Some ( Implementation ( Platform :: Avx2 ) ) ;
81
81
}
82
82
}
83
83
None
@@ -86,9 +86,9 @@ impl Implementation {
86
86
pub fn degree ( & self ) -> usize {
87
87
match self . 0 {
88
88
#[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
89
- Platform :: AVX2 => avx2:: DEGREE ,
89
+ Platform :: Avx2 => avx2:: DEGREE ,
90
90
#[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
91
- Platform :: SSE41 => sse41:: DEGREE ,
91
+ Platform :: Sse41 => sse41:: DEGREE ,
92
92
Platform :: Portable => 1 ,
93
93
}
94
94
}
@@ -104,7 +104,7 @@ impl Implementation {
104
104
) {
105
105
match self . 0 {
106
106
#[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
107
- Platform :: AVX2 => unsafe {
107
+ Platform :: Avx2 => unsafe {
108
108
avx2:: compress1_loop ( input, words, count, last_node, finalize, stride) ;
109
109
} ,
110
110
// Note that there's an SSE version of compress1 in the official C
@@ -118,7 +118,7 @@ impl Implementation {
118
118
pub fn compress2_loop ( & self , jobs : & mut [ Job < ' _ , ' _ > ; 2 ] , finalize : Finalize , stride : Stride ) {
119
119
match self . 0 {
120
120
#[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
121
- Platform :: AVX2 | Platform :: SSE41 => unsafe {
121
+ Platform :: Avx2 | Platform :: Sse41 => unsafe {
122
122
sse41:: compress2_loop ( jobs, finalize, stride)
123
123
} ,
124
124
_ => panic ! ( "unsupported" ) ,
@@ -128,7 +128,7 @@ impl Implementation {
128
128
pub fn compress4_loop ( & self , jobs : & mut [ Job < ' _ , ' _ > ; 4 ] , finalize : Finalize , stride : Stride ) {
129
129
match self . 0 {
130
130
#[ 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) } ,
132
132
_ => panic ! ( "unsupported" ) ,
133
133
}
134
134
}
@@ -271,20 +271,20 @@ mod test {
271
271
#[ cfg( feature = "std" ) ]
272
272
{
273
273
if is_x86_feature_detected ! ( "avx2" ) {
274
- assert_eq ! ( Platform :: AVX2 , Implementation :: detect( ) . 0 ) ;
274
+ assert_eq ! ( Platform :: Avx2 , Implementation :: detect( ) . 0 ) ;
275
275
assert_eq ! (
276
- Platform :: AVX2 ,
276
+ Platform :: Avx2 ,
277
277
Implementation :: avx2_if_supported( ) . unwrap( ) . 0
278
278
) ;
279
279
assert_eq ! (
280
- Platform :: SSE41 ,
280
+ Platform :: Sse41 ,
281
281
Implementation :: sse41_if_supported( ) . unwrap( ) . 0
282
282
) ;
283
283
} else if is_x86_feature_detected ! ( "sse4.1" ) {
284
- assert_eq ! ( Platform :: SSE41 , Implementation :: detect( ) . 0 ) ;
284
+ assert_eq ! ( Platform :: Sse41 , Implementation :: detect( ) . 0 ) ;
285
285
assert ! ( Implementation :: avx2_if_supported( ) . is_none( ) ) ;
286
286
assert_eq ! (
287
- Platform :: SSE41 ,
287
+ Platform :: Sse41 ,
288
288
Implementation :: sse41_if_supported( ) . unwrap( ) . 0
289
289
) ;
290
290
} else {
@@ -302,9 +302,9 @@ mod test {
302
302
{
303
303
// Chose counts to hit the relevant overflow cases.
304
304
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 ) ,
308
308
] ;
309
309
for & stride in & [ Stride :: Serial , Stride :: Parallel ] {
310
310
let lengths = [
0 commit comments