Skip to content

Commit

Permalink
fix: remove special case for aarch64
Browse files Browse the repository at this point in the history
The special case for aarch64 is no longer needed.
  • Loading branch information
vmx committed Jan 13, 2025
1 parent debe99f commit 1750916
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions fr32/src/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ use std::cmp::min;
use std::io::{self, Read};
use std::mem::size_of;

#[cfg(not(target_arch = "aarch64"))]
use byte_slice_cast::AsSliceOf;

use byte_slice_cast::AsByteSlice;
use byte_slice_cast::{AsByteSlice, AsSliceOf};

/// The number of Frs per Block.
const NUM_FRS_PER_BLOCK: usize = 4;
Expand Down Expand Up @@ -71,18 +68,11 @@ impl<R: Read> Fr32Reader<R> {

/// Processes a single block in in_buffer, writing the result to out_buffer.
fn process_block(&mut self) {
let in_buffer: &[u128] = {
#[cfg(target_arch = "aarch64")]
// Safety: This is safe because the struct/data is aligned on
// a 16 byte boundary and can therefore be casted from u128
// to u8 without alignment safety issues.
#[allow(clippy::cast_slice_different_sizes)]
unsafe {
&mut (*(&mut self.in_buffer.0 as *const [u8] as *mut [u128]))
}
#[cfg(not(target_arch = "aarch64"))]
self.in_buffer.0.as_slice_of::<u128>().unwrap()
};
let in_buffer: &[u128] = self
.in_buffer
.0
.as_slice_of::<u128>()
.expect("slice can be read as list of u128s");
let out = &mut self.out_buffer;

// 0..254
Expand Down

0 comments on commit 1750916

Please sign in to comment.