#x86 #detection #arch #features #cpuid #detect

no-std core_detect

A no_std version of the std::is_x86_feature_detected! macro

2 releases (1 stable)

1.0.0 May 9, 2021
0.1.0 Sep 21, 2020

#608 in Hardware support

Download history 70/week @ 2023-12-14 114/week @ 2023-12-21 189/week @ 2023-12-28 51/week @ 2024-01-04 75/week @ 2024-01-11 81/week @ 2024-01-18 158/week @ 2024-01-25 28/week @ 2024-02-01 5/week @ 2024-02-08 37/week @ 2024-02-15 229/week @ 2024-02-22 255/week @ 2024-02-29 661/week @ 2024-03-07 513/week @ 2024-03-14 373/week @ 2024-03-21 262/week @ 2024-03-28

1,828 downloads per month

MIT/Apache

37KB
408 lines

core_detect

Build Status Docs Latest Version Minimum Rust Version

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.

Usage

Add core_detect = "1" to the [dependencies] section of your Cargo.toml.

if core_detect::is_x86_feature_detected!("ssse3") {
    println!("SSSE3 is available");
}

License / Copyright

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.

No runtime deps