Skip to content

Commit ee466a0

Browse files
committed
fix: remove special case for aarch64
The special case for aarch64 is no longer needed and make things compile smoothly.
1 parent beb7bd9 commit ee466a0

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

fr32/src/reader.rs

+6-15
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ use std::cmp::min;
22
use std::io::{self, Read};
33
use std::mem::size_of;
44

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};
96

107
/// The number of Frs per Block.
118
const NUM_FRS_PER_BLOCK: usize = 4;
@@ -71,17 +68,11 @@ impl<R: Read> Fr32Reader<R> {
7168

7269
/// Processes a single block in in_buffer, writing the result to out_buffer.
7370
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");
8576
let out = &mut self.out_buffer;
8677

8778
// 0..254

0 commit comments

Comments
 (0)