Skip to content

Commit 7fd6bd7

Browse files
committed
fix(cksum): use correct cpufeatures macro API for CPU feature detection
The cpufeatures crate uses a macro-based API (cpufeatures::new!) rather than direct function calls. This fixes compilation errors where has_avx512f, has_avx512bw, has_avx2, and has_pclmul functions were not found. The correct API uses: - cpufeatures::new!(module_name, "feature1", "feature2") - module_name::get() to check if all features are available Also corrected pclmulqdq feature name (was has_pclmul, should be pclmulqdq).
1 parent 09efa85 commit 7fd6bd7

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/uu/cksum/src/hardware.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ impl CpuFeatures {
6969

7070
#[cfg(target_arch = "x86_64")]
7171
fn has_avx512() -> bool {
72-
cpufeatures::has_avx512f() && cpufeatures::has_avx512bw()
72+
cpufeatures::new!(cpuid_avx512, "avx512f", "avx512bw");
73+
cpuid_avx512::get()
7374
}
7475

7576
#[cfg(not(target_arch = "x86_64"))]
@@ -79,7 +80,8 @@ fn has_avx512() -> bool {
7980

8081
#[cfg(target_arch = "x86_64")]
8182
fn has_avx2() -> bool {
82-
cpufeatures::has_avx2()
83+
cpufeatures::new!(cpuid_avx2, "avx2");
84+
cpuid_avx2::get()
8385
}
8486

8587
#[cfg(not(target_arch = "x86_64"))]
@@ -89,7 +91,8 @@ fn has_avx2() -> bool {
8991

9092
#[cfg(target_arch = "x86_64")]
9193
fn has_pclmul() -> bool {
92-
cpufeatures::has_pclmul()
94+
cpufeatures::new!(cpuid_pclmul, "pclmulqdq");
95+
cpuid_pclmul::get()
9396
}
9497

9598
#[cfg(not(target_arch = "x86_64"))]

0 commit comments

Comments
 (0)