Skip to content

Commit 43925bb

Browse files
committed
Merge remote-tracking branch 'loadingalias/main' into add-no_std-and-wasm
2 parents 13dc1d8 + c2d5bac commit 43925bb

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,15 @@ DESTDIR=/my/custom/path make install
6868

6969
The library supports various feature flags for different environments:
7070

71-
* `std` (default) - Standard library support, includes `alloc`
71+
### Default Features
72+
* `std` - Standard library support, includes `alloc`
73+
* `ffi` - C/C++ FFI bindings for shared library (will become optional in v2.0)
74+
* `panic-handler` - Provides panic handler for `no_std` environments (disable when building binaries)
75+
76+
### Optional Features
7277
* `alloc` - Heap allocation support (enables `Digest` trait, custom CRC params, checksum combining)
7378
* `cache` - Caches generated constants for custom CRC parameters (requires `alloc`)
7479
* `cli` - Enables command-line tools (`checksum`, `arch-check`, `get-custom-params`)
75-
* `ffi` - C/C++ FFI bindings for shared library
76-
* `panic-handler` - Provides panic handler for `no_std` environments (disable when building binaries)
7780

7881
### Building for `no_std`
7982

src/feature_detection.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,10 @@ unsafe fn detect_aarch64_features() -> ArchCapabilities {
175175
unsafe fn detect_aarch64_features() -> ArchCapabilities {
176176
ArchCapabilities {
177177
has_aes: cfg!(target_feature = "aes"),
178+
has_crc: cfg!(target_feature = "crc"),
178179
has_sha3: cfg!(target_feature = "sha3"),
179180
has_sse41: false,
181+
has_sse42: false,
180182
has_pclmulqdq: false,
181183
has_avx512vl: false,
182184
has_vpclmulqdq: false,
@@ -225,6 +227,7 @@ unsafe fn detect_x86_features() -> ArchCapabilities {
225227
let rust_version_supports_avx512 = check_rust_version_supports_avx512();
226228

227229
let has_sse41 = cfg!(target_feature = "sse4.1");
230+
let has_sse42 = cfg!(target_feature = "sse4.2");
228231
let has_pclmulqdq = has_sse41 && cfg!(target_feature = "pclmulqdq");
229232
let has_avx512vl =
230233
has_pclmulqdq && rust_version_supports_avx512 && cfg!(target_feature = "avx512vl");
@@ -233,8 +236,10 @@ unsafe fn detect_x86_features() -> ArchCapabilities {
233236

234237
ArchCapabilities {
235238
has_aes: false,
239+
has_crc: false,
236240
has_sha3: false,
237241
has_sse41,
242+
has_sse42,
238243
has_pclmulqdq,
239244
has_avx512vl,
240245
has_vpclmulqdq,

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ use digest::DynDigest;
207207
#[cfg(feature = "alloc")]
208208
use digest::InvalidBufferSize;
209209

210+
#[cfg(any(target_arch = "x86", target_arch = "x86_64", target_arch = "aarch64"))]
210211
use crate::feature_detection::get_arch_ops;
211212
#[cfg(feature = "std")]
212213
use std::fs::File;

0 commit comments

Comments
 (0)