Skip to content

Commit

Permalink
Remove runtime checks
Browse files Browse the repository at this point in the history
  • Loading branch information
ogxd committed Jan 20, 2024
1 parent 1864a14 commit 1f66f84
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/gxhash/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ pub(crate) unsafe fn gxhash(input: &[u8], seed: State) -> State {
#[inline]
pub(crate) unsafe fn compress_all(input: &[u8]) -> State {

if !check_support() {
panic!("Not supported");
}
// if !check_support() {
// panic!("Not supported");
// }

let len = input.len();
let mut ptr = input.as_ptr() as *const State;
Expand Down
8 changes: 4 additions & 4 deletions src/gxhash/platform/arm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ use super::*;

pub type State = int8x16_t;

#[inline(always)]
pub unsafe fn check_support() -> bool {
std::arch::is_aarch64_feature_detected!("aes") && std::arch::is_aarch64_feature_detected!("neon")
}
// #[inline(always)]
// pub unsafe fn check_support() -> bool {
// std::arch::is_aarch64_feature_detected!("aes") && std::arch::is_aarch64_feature_detected!("neon")
// }

enable_target_feature! {"neon", "aes";

Expand Down
6 changes: 3 additions & 3 deletions src/gxhash/platform/x86.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ use super::*;

pub type State = __m128i;

pub unsafe fn check_support() -> bool {
std::arch::is_x86_feature_detected!("aes") && std::arch::is_x86_feature_detected!("sse2")
}
// pub unsafe fn check_support() -> bool {
// std::arch::is_x86_feature_detected!("aes") && std::arch::is_x86_feature_detected!("sse2")
// }

enable_target_feature! {"sse2", "aes";

Expand Down

0 comments on commit 1f66f84

Please sign in to comment.