2个版本 (1个稳定版)
1.0.0 | 2021年5月9日 |
---|---|
0.1.0 | 2020年9月21日 |
#504 在 硬件支持
每月下载 685次
37KB
408 代码行
core_detect
此crate提供了一个 no_std
版本的 std::is_x86_feature_detected!
宏。
这是可能的,因为x86芯片可以使用 cpuid
指令来检测CPU特性,而大多数其他架构则需要读取文件或查询操作系统。
用法
将 core_detect = "1"
添加到你的 Cargo.toml 的 [dependencies]
部分。
if core_detect::is_x86_feature_detected!("ssse3") {
println!("SSSE3 is available");
}
许可证/版权
此代码的大部分来自 stdarch
仓库(便于升级/最大兼容性),因此它使用与Rust相同的版权——MIT/Apache-2.0双重许可证。