Skip to content

Commit

Permalink
Remove asm for crc32cb instruction
Browse files Browse the repository at this point in the history
  • Loading branch information
zowens committed Feb 8, 2024
1 parent 8799754 commit 39e1b28
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions src/hw_aarch64.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use crate::hw_tables;
use crate::util::{self, U64Le};

use std::arch::aarch64 as simd;
use std::arch::asm;

pub unsafe fn crc32c(crci: u32, buffer: &[u8]) -> u32 {
let mut crc0 = !crci;
Expand Down Expand Up @@ -46,18 +44,8 @@ pub unsafe fn crc32c(crci: u32, buffer: &[u8]) -> u32 {

#[inline]
#[target_feature(enable = "crc")]
pub unsafe fn __crc32b(mut crc: u32, data: u8) -> u32 {
asm!(
"crc32cb {0:w}, {0:w}, {1:w}",
inout(reg) crc,
in(reg) data,
);
crc
}

#[inline]
unsafe fn crc_u8(crc: u32, buffer: &[u8]) -> u32 {
buffer.iter().fold(crc, |crc, &next| __crc32b(crc, next))
buffer.iter().fold(crc, |crc, &next| simd::__crc32cb(crc, next))
}

#[inline(always)]
Expand Down

0 comments on commit 39e1b28

Please sign in to comment.