Skip to content

Commit 2a38441

Browse files
committed
Fix bug on software-only architectures
1 parent ae800ef commit 2a38441

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ crate-type = ["lib", "cdylib", "staticlib"]
2222
bench = true
2323

2424
[dependencies]
25-
# can move to crc 3.4+ once our MSRV is Rust 1.82+
2625
crc = "3.4"
2726

2827
# We use digest with default-features = false and features = ["alloc"] to enable heap allocation support in no_std

src/feature_detection.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ pub(crate) fn select_performance_tier(capabilities: &ArchCapabilities) -> Perfor
269269

270270
/// Enum that holds the different ArchOps implementations for compile-time dispatch
271271
/// This avoids the need for trait objects while still providing factory-based selection
272+
#[cfg(any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64"))]
272273
#[derive(Debug, Clone, Copy)]
273274
pub enum ArchOpsInstance {
274275
#[cfg(target_arch = "aarch64")]
@@ -285,6 +286,7 @@ pub enum ArchOpsInstance {
285286
SoftwareFallback,
286287
}
287288

289+
#[cfg(any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64"))]
288290
impl ArchOpsInstance {
289291
#[inline(always)]
290292
pub fn get_tier(&self) -> PerformanceTier {
@@ -304,7 +306,10 @@ impl ArchOpsInstance {
304306
}
305307

306308
/// Get a human-readable target string describing the active configuration
307-
#[cfg(feature = "alloc")]
309+
#[cfg(all(
310+
feature = "alloc",
311+
any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")
312+
))]
308313
#[inline(always)]
309314
pub fn get_target_string(&self) -> String {
310315
tier_to_target_string(self.get_tier())
@@ -346,6 +351,7 @@ fn create_arch_ops() -> ArchOpsInstance {
346351
}
347352

348353
/// Helper function to create ArchOpsInstance from a performance tier
354+
#[cfg(any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64"))]
349355
fn create_arch_ops_from_tier(tier: PerformanceTier) -> ArchOpsInstance {
350356
match tier {
351357
#[cfg(target_arch = "aarch64")]

0 commit comments

Comments
 (0)