Skip to content

Commit

Permalink
Remove detect-cpufeatures feature
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelsproul committed Jul 26, 2024
1 parent 12b14da commit 9f5e9cd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ring = "0.17"
sha2 = "0.10"

[target.'cfg(target_arch = "x86_64")'.dependencies]
cpufeatures = { version = "0.2", optional = true }
cpufeatures = "0.2"

[dev-dependencies]
rustc-hex = "2"
Expand All @@ -25,6 +25,5 @@ rustc-hex = "2"
wasm-bindgen-test = "0.3.33"

[features]
default = ["zero_hash_cache", "detect-cpufeatures"]
default = ["zero_hash_cache"]
zero_hash_cache = ["lazy_static"]
detect-cpufeatures = ["cpufeatures"]
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ pub enum DynamicImpl {
// Runtime latch for detecting the availability of SHA extensions on x86_64.
//
// Inspired by the runtime switch within the `sha2` crate itself.
#[cfg(all(feature = "detect-cpufeatures", target_arch = "x86_64"))]
#[cfg(target_arch = "x86_64")]
cpufeatures::new!(x86_sha_extensions, "sha", "sse2", "ssse3", "sse4.1");

#[inline(always)]
pub fn have_sha_extensions() -> bool {
#[cfg(all(feature = "detect-cpufeatures", target_arch = "x86_64"))]
#[cfg(target_arch = "x86_64")]
return x86_sha_extensions::get();

#[cfg(not(all(feature = "detect-cpufeatures", target_arch = "x86_64")))]
#[cfg(not(target_arch = "x86_64"))]
return false;
}

Expand Down

0 comments on commit 9f5e9cd

Please sign in to comment.