@@ -13,9 +13,6 @@ use core::cmp;
13
13
#[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
14
14
pub const MAX_DEGREE : usize = 4 ;
15
15
16
- #[ cfg( not( any( target_arch = "x86" , target_arch = "x86_64" ) ) ) ]
17
- pub const MAX_DEGREE : usize = 1 ;
18
-
19
16
/// Variants other than Portable are unreachable in no_std, unless CPU features
20
17
/// are explicitly enabled for the build with e.g. RUSTFLAGS="-C target-feature=avx2".
21
18
/// This might change in the future if is_x86_feature_detected moves into libcore.
@@ -91,11 +88,10 @@ impl Implementation {
91
88
None
92
89
}
93
90
91
+ #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
94
92
pub fn degree ( & self ) -> usize {
95
93
match self . 0 {
96
- #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
97
94
Platform :: Avx2 => avx2:: DEGREE ,
98
- #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
99
95
Platform :: Sse41 => sse41:: DEGREE ,
100
96
Platform :: Portable => 1 ,
101
97
}
@@ -123,19 +119,19 @@ impl Implementation {
123
119
}
124
120
}
125
121
122
+ #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
126
123
pub fn compress2_loop ( & self , jobs : & mut [ Job < ' _ , ' _ > ; 2 ] , finalize : Finalize , stride : Stride ) {
127
124
match self . 0 {
128
- #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
129
125
Platform :: Avx2 | Platform :: Sse41 => unsafe {
130
126
sse41:: compress2_loop ( jobs, finalize, stride)
131
127
} ,
132
128
_ => panic ! ( "unsupported" ) ,
133
129
}
134
130
}
135
131
132
+ #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
136
133
pub fn compress4_loop ( & self , jobs : & mut [ Job < ' _ , ' _ > ; 4 ] , finalize : Finalize , stride : Stride ) {
137
134
match self . 0 {
138
- #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
139
135
Platform :: Avx2 => unsafe { avx2:: compress4_loop ( jobs, finalize, stride) } ,
140
136
_ => panic ! ( "unsupported" ) ,
141
137
}
@@ -196,14 +192,16 @@ impl LastNode {
196
192
197
193
#[ derive( Clone , Copy , Debug ) ]
198
194
pub enum Stride {
199
- Serial , // BLAKE2b/BLAKE2s
195
+ Serial , // BLAKE2b/BLAKE2s
196
+ #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
200
197
Parallel , // BLAKE2bp/BLAKE2sp
201
198
}
202
199
203
200
impl Stride {
204
201
pub fn padded_blockbytes ( & self ) -> usize {
205
202
match self {
206
203
Stride :: Serial => BLOCKBYTES ,
204
+ #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
207
205
Stride :: Parallel => crate :: blake2bp:: DEGREE * BLOCKBYTES ,
208
206
}
209
207
}
@@ -217,6 +215,7 @@ pub(crate) fn count_high(count: Count) -> Word {
217
215
( count >> ( 8 * size_of :: < Word > ( ) ) ) as Word
218
216
}
219
217
218
+ #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
220
219
pub ( crate ) fn assemble_count ( low : Word , high : Word ) -> Count {
221
220
low as Count + ( ( high as Count ) << ( 8 * size_of :: < Word > ( ) ) )
222
221
}
0 commit comments