Skip to content

Commit

Permalink
Add check on sse2 and neon (#76)
Browse files Browse the repository at this point in the history
* Add missing check on sse2 feature

* 3.3.2

* Cleanup
  • Loading branch information
ogxd authored May 27, 2024
1 parent 9bca158 commit 97efe40
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "gxhash"
authors = ["Olivier Giniaux"]
version = "3.3.1"
version = "3.3.2"
edition = "2021"
description = "GxHash non-cryptographic algorithm"
license = "MIT"
Expand Down
3 changes: 3 additions & 0 deletions src/gxhash/platform/arm.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#[cfg(not(any(all(target_feature = "aes", target_feature = "neon"), docsrs)))] // docs.rs bypasses the target_feature check
compile_error!{"Gxhash requires aes and neon intrinsics. Make sure the processor supports it and build with RUSTFLAGS=\"-C target-cpu=native\" or RUSTFLAGS=\"-C target-feature=+aes,+neon\"."}

#[cfg(target_arch = "arm")]
use core::arch::arm::*;
#[cfg(target_arch = "aarch64")]
Expand Down
2 changes: 0 additions & 2 deletions src/gxhash/platform/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
#[cfg(all(target_feature = "aes", target_feature = "neon"))]
#[path = "arm.rs"]
mod platform;

#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
#[cfg(any(all(target_feature = "aes", target_feature = "sse2"), docsrs))] // docsrs bypasses the target_feature check
#[path = "x86.rs"]
mod platform;

Expand Down
6 changes: 6 additions & 0 deletions src/gxhash/platform/x86.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#[cfg(not(any(all(target_feature = "aes", target_feature = "sse2"), docsrs)))] // docs.rs bypasses the target_feature check
compile_error!{"Gxhash requires aes and sse2 intrinsics. Make sure the processor supports it and build with RUSTFLAGS=\"-C target-cpu=native\" or RUSTFLAGS=\"-C target-feature=+aes,+sse2\"."}

#[cfg(all(feature = "hybrid", not(any(target_feature = "aes", target_feature = "vaes", target_feature = "avx2"))))]
compile_error!{"Hybrid feature is only available on x86 processors with avx2 and vaes intrinsics."}

#[cfg(target_arch = "x86")]
use core::arch::x86::*;
#[cfg(target_arch = "x86_64")]
Expand Down
6 changes: 0 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@
// Hybrid SIMD width usage currently requires unstable 'stdsimd'
#![cfg_attr(feature = "hybrid", feature(stdarch_x86_avx512))]

#[cfg(all(feature = "hybrid", not(any(target_arch = "x86_64", target_feature = "aes", target_feature = "vaes", target_feature = "avx2"))))]
compile_error!{"Hybrid feature is only available on x86 processors with avx2 and vaes intrinsics."}

#[cfg(not(target_feature = "aes"))]
compile_error!{"Gxhash requires aes intrinsics. Make sure the processor supports it and build with RUSTFLAGS=\"-C target-cpu=native\" or RUSTFLAGS=\"-C target-feature=+aes\"."}

#[rustfmt::skip]
mod gxhash;
pub use crate::gxhash::*;
Expand Down

0 comments on commit 97efe40

Please sign in to comment.