Skip to content

Commit 4fc8fb6

Browse files
committed
crc-fast-rust: fixing unused type aliases; fixing flags.
1 parent 990024f commit 4fc8fb6

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ indexmap = { version = ">=2.11.0, <2.12.0", optional = true }
3333

3434
# no_std support
3535
# spin is always required for no_std builds (feature detection synchronization)
36-
spin = { version = "0.10.0", default-features = false, features = ["once", "rwlock"] }
36+
spin = { version = "0.10.0", default-features = false, features = ["once", "rwlock", "mutex", "spin_mutex"] }
3737
# hashbrown is only needed when caching is enabled in no_std
3838
hashbrown = { version = "0.16.0", optional = true }
3939

src/arch/software.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ use spin::{Mutex, Once};
2626

2727
// Cache key types for custom algorithms
2828
#[cfg(feature = "alloc")]
29+
#[cfg(any(feature = "std", feature = "cache"))]
2930
type Crc32Key = (u32, u32, bool, bool, u32, u32);
3031
#[cfg(feature = "alloc")]
32+
#[cfg(any(feature = "std", feature = "cache"))]
3133
type Crc64Key = (u64, u64, bool, bool, u64, u64);
3234

3335
// Global caches for custom algorithms (std version)

src/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ use crate::crc32::consts::{
194194
};
195195

196196
#[cfg(any(target_arch = "x86", target_arch = "x86_64", target_arch = "aarch64"))]
197+
#[cfg(feature = "std")]
197198
use crate::crc32::fusion;
198199

199200
use crate::crc64::consts::{
@@ -947,7 +948,7 @@ fn get_calculator_params(algorithm: CrcAlgorithm) -> (CalculatorFn, CrcParams) {
947948
/// fusion techniques to accelerate the calculation beyond what SIMD can do alone.
948949
#[inline(always)]
949950
fn crc32_iscsi_calculator(state: u64, data: &[u8], _params: CrcParams) -> u64 {
950-
#[cfg(target_arch = "aarch64")]
951+
#[cfg(all(target_arch = "aarch64", feature = "std"))]
951952
{
952953
use std::arch::is_aarch64_feature_detected;
953954
if is_aarch64_feature_detected!("aes") && is_aarch64_feature_detected!("crc") {
@@ -956,7 +957,7 @@ fn crc32_iscsi_calculator(state: u64, data: &[u8], _params: CrcParams) -> u64 {
956957
}
957958

958959
// both aarch64 and x86 have native CRC-32/ISCSI support, so we can use fusion
959-
#[cfg(any(target_arch = "x86_64", target_arch = "x86"))]
960+
#[cfg(all(any(target_arch = "x86_64", target_arch = "x86"), feature = "std"))]
960961
{
961962
use std::arch::is_x86_feature_detected;
962963
if is_x86_feature_detected!("sse4.2") && is_x86_feature_detected!("pclmulqdq") {
@@ -977,7 +978,7 @@ fn crc32_iscsi_calculator(state: u64, data: &[u8], _params: CrcParams) -> u64 {
977978
#[inline(always)]
978979
fn crc32_iso_hdlc_calculator(state: u64, data: &[u8], _params: CrcParams) -> u64 {
979980
// aarch64 CPUs have native CRC-32/ISO-HDLC support, so we can use the fusion implementation
980-
#[cfg(target_arch = "aarch64")]
981+
#[cfg(all(target_arch = "aarch64", feature = "std"))]
981982
{
982983
use std::arch::is_aarch64_feature_detected;
983984
if is_aarch64_feature_detected!("aes") && is_aarch64_feature_detected!("crc") {

0 commit comments

Comments
 (0)