Crates.io | core_detect |
lib.rs | core_detect |
version | 1.0.0 |
source | src |
created_at | 2020-09-21 09:40:25.340866 |
updated_at | 2021-05-09 16:36:07.524627 |
description | A `no_std` version of the `std::is_x86_feature_detected!` macro. |
homepage | https://github.com/thomcc/core_detect |
repository | https://github.com/thomcc/core_detect |
max_upload_size | |
id | 291059 |
size | 59,050 |
core_detect
This crate provides a no_std
version of the std::is_x86_feature_detected!
macro.
This is possible because x86 chips can just use the cpuid
instruction to detect CPU features, whereas most other architectures require either reading files or querying the OS.
Add core_detect = "1"
to the [dependencies]
section of your Cargo.toml.
if core_detect::is_x86_feature_detected!("ssse3") {
println!("SSSE3 is available");
}
Much of this code is taken from the stdarch
repository (for easy upgrading / maximal compatibility), and thus it uses the same copyright as Rust — MIT/Apache-2.0 dual license.