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

no-std core_detect

A no_std 版本的 std::is_x86_feature_detected!

2个版本 (1个稳定版)

1.0.0 2021年5月9日
0.1.0 2020年9月21日

#504硬件支持

Download history 564/week @ 2024-03-11 405/week @ 2024-03-18 345/week @ 2024-03-25 353/week @ 2024-04-01 432/week @ 2024-04-08 187/week @ 2024-04-15 334/week @ 2024-04-22 285/week @ 2024-04-29 437/week @ 2024-05-06 139/week @ 2024-05-13 87/week @ 2024-05-20 342/week @ 2024-05-27 180/week @ 2024-06-03 98/week @ 2024-06-10 191/week @ 2024-06-17 207/week @ 2024-06-24

每月下载 685次

MIT/Apache

37KB
408 代码行

core_detect

Build Status Docs Latest Version Minimum Rust Version

此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双重许可证。

无运行时依赖