@@ -13,9 +13,6 @@ use core::cmp;
1313#[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
1414pub const MAX_DEGREE : usize = 4 ;
1515
16- #[ cfg( not( any( target_arch = "x86" , target_arch = "x86_64" ) ) ) ]
17- pub const MAX_DEGREE : usize = 1 ;
18-
1916/// Variants other than Portable are unreachable in no_std, unless CPU features
2017/// are explicitly enabled for the build with e.g. RUSTFLAGS="-C target-feature=avx2".
2118/// This might change in the future if is_x86_feature_detected moves into libcore.
@@ -91,11 +88,10 @@ impl Implementation {
9188 None
9289 }
9390
91+ #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
9492 pub fn degree ( & self ) -> usize {
9593 match self . 0 {
96- #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
9794 Platform :: Avx2 => avx2:: DEGREE ,
98- #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
9995 Platform :: Sse41 => sse41:: DEGREE ,
10096 Platform :: Portable => 1 ,
10197 }
@@ -123,19 +119,19 @@ impl Implementation {
123119 }
124120 }
125121
122+ #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
126123 pub fn compress2_loop ( & self , jobs : & mut [ Job < ' _ , ' _ > ; 2 ] , finalize : Finalize , stride : Stride ) {
127124 match self . 0 {
128- #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
129125 Platform :: Avx2 | Platform :: Sse41 => unsafe {
130126 sse41:: compress2_loop ( jobs, finalize, stride)
131127 } ,
132128 _ => panic ! ( "unsupported" ) ,
133129 }
134130 }
135131
132+ #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
136133 pub fn compress4_loop ( & self , jobs : & mut [ Job < ' _ , ' _ > ; 4 ] , finalize : Finalize , stride : Stride ) {
137134 match self . 0 {
138- #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
139135 Platform :: Avx2 => unsafe { avx2:: compress4_loop ( jobs, finalize, stride) } ,
140136 _ => panic ! ( "unsupported" ) ,
141137 }
@@ -196,14 +192,16 @@ impl LastNode {
196192
197193#[ derive( Clone , Copy , Debug ) ]
198194pub enum Stride {
199- Serial , // BLAKE2b/BLAKE2s
195+ Serial , // BLAKE2b/BLAKE2s
196+ #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
200197 Parallel , // BLAKE2bp/BLAKE2sp
201198}
202199
203200impl Stride {
204201 pub fn padded_blockbytes ( & self ) -> usize {
205202 match self {
206203 Stride :: Serial => BLOCKBYTES ,
204+ #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
207205 Stride :: Parallel => crate :: blake2bp:: DEGREE * BLOCKBYTES ,
208206 }
209207 }
@@ -217,6 +215,7 @@ pub(crate) fn count_high(count: Count) -> Word {
217215 ( count >> ( 8 * size_of :: < Word > ( ) ) ) as Word
218216}
219217
218+ #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
220219pub ( crate ) fn assemble_count ( low : Word , high : Word ) -> Count {
221220 low as Count + ( ( high as Count ) << ( 8 * size_of :: < Word > ( ) ) )
222221}
0 commit comments