diff --git a/hashes/src/lib.rs b/hashes/src/lib.rs index 00ca7fd70..cc5d191bc 100644 --- a/hashes/src/lib.rs +++ b/hashes/src/lib.rs @@ -50,7 +50,7 @@ //! # } //! ``` -#![cfg_attr(not(feature = "std"), no_std)] +#![no_std] // Experimental features we need. #![cfg_attr(docsrs, feature(doc_auto_cfg))] #![cfg_attr(bench, feature(test))] @@ -70,6 +70,9 @@ extern crate alloc; extern crate core; +#[cfg(feature = "std")] +extern crate std; + #[cfg(feature = "bitcoin-io")] extern crate bitcoin_io as io; diff --git a/hashes/src/sha256.rs b/hashes/src/sha256.rs index 6cdad22c9..42fe5cf24 100644 --- a/hashes/src/sha256.rs +++ b/hashes/src/sha256.rs @@ -491,10 +491,10 @@ impl HashEngine { fn process_block(&mut self) { #[cfg(all(feature = "std", any(target_arch = "x86", target_arch = "x86_64")))] { - if is_x86_feature_detected!("sse4.1") - && is_x86_feature_detected!("sha") - && is_x86_feature_detected!("sse2") - && is_x86_feature_detected!("ssse3") + if std::is_x86_feature_detected!("sse4.1") + && std::is_x86_feature_detected!("sha") + && std::is_x86_feature_detected!("sse2") + && std::is_x86_feature_detected!("ssse3") { return unsafe { self.process_block_simd_x86_intrinsics() }; }