Commit ee466a0 1 parent beb7bd9 commit ee466a0 Copy full SHA for ee466a0
File tree 1 file changed +6
-15
lines changed
1 file changed +6
-15
lines changed Original file line number Diff line number Diff line change @@ -2,10 +2,7 @@ use std::cmp::min;
2
2
use std:: io:: { self , Read } ;
3
3
use std:: mem:: size_of;
4
4
5
- #[ cfg( not( target_arch = "aarch64" ) ) ]
6
- use byte_slice_cast:: AsSliceOf ;
7
-
8
- use byte_slice_cast:: AsByteSlice ;
5
+ use byte_slice_cast:: { AsByteSlice , AsSliceOf } ;
9
6
10
7
/// The number of Frs per Block.
11
8
const NUM_FRS_PER_BLOCK : usize = 4 ;
@@ -71,17 +68,11 @@ impl<R: Read> Fr32Reader<R> {
71
68
72
69
/// Processes a single block in in_buffer, writing the result to out_buffer.
73
70
fn process_block ( & mut self ) {
74
- let in_buffer: & [ u128 ] = {
75
- #[ cfg( target_arch = "aarch64" ) ]
76
- // Safety: This is safe because the struct/data is aligned on
77
- // a 16 byte boundary and can therefore be casted from u128
78
- // to u8 without alignment safety issues.
79
- unsafe {
80
- & mut ( * ( & self . in_buffer . 0 as * const [ u8 ] as * mut [ u128 ] ) )
81
- }
82
- #[ cfg( not( target_arch = "aarch64" ) ) ]
83
- self . in_buffer . 0 . as_slice_of :: < u128 > ( ) . unwrap ( )
84
- } ;
71
+ let in_buffer: & [ u128 ] = self
72
+ . in_buffer
73
+ . 0
74
+ . as_slice_of :: < u128 > ( )
75
+ . expect ( "slice can be used as list of u128s" ) ;
85
76
let out = & mut self . out_buffer ;
86
77
87
78
// 0..254
You can’t perform that action at this time.
0 commit comments