mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-22 06:14:38 +00:00
eth2_hashing: make cpufeatures dep optional (#3309)
## Issue Addressed #3308 ## Proposed Changes * add `cpufeatures` feature. * make `cpufeature` default feature to preserve the compatibility; * hide all `cpufeature`-related code with `cpufeatures` feature. Co-authored-by: Kirill <kirill@aurora.dev>
This commit is contained in:
@@ -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(target_arch = "x86_64")]
|
||||
#[cfg(all(feature = "detect-cpufeatures", target_arch = "x86_64"))]
|
||||
cpufeatures::new!(x86_sha_extensions, "sha", "sse2", "ssse3", "sse4.1");
|
||||
|
||||
#[inline(always)]
|
||||
pub fn have_sha_extensions() -> bool {
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
#[cfg(all(feature = "detect-cpufeatures", target_arch = "x86_64"))]
|
||||
return x86_sha_extensions::get();
|
||||
|
||||
#[cfg(not(target_arch = "x86_64"))]
|
||||
#[cfg(not(all(feature = "detect-cpufeatures", target_arch = "x86_64")))]
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user