Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ on:
branches:
- master

env:
MSRV: "1.63.0"

jobs:
stable:
name: stable
Expand Down Expand Up @@ -51,8 +48,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get MSRV from Cargo.toml
id: msrv
run: echo "version=$(grep '^rust-version' Cargo.toml | sed 's/rust-version = "\(.*\)"/\1/')" >> $GITHUB_OUTPUT
- name: Install Rust
run: rustup update $MSRV && rustup default $MSRV
run: rustup update ${{ steps.msrv.outputs.version }} && rustup default ${{ steps.msrv.outputs.version }}
- name: Test in debug mode
run: cargo test --no-fail-fast
- name: Test in release mode
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ repository = "https://github.com/srijs/rust-crc32fast"
readme = "README.md"
keywords = ["hash", "crc", "crc32", "simd", "fast"]
categories = ["algorithms", "no-std"]
rust-version = "1.63"

[dependencies]
cfg-if = "1.0"
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ Note: Because runtime CPU feature detection requires OS support, the specialized
This feature flag enables unstable features that are only available on the `nightly` channel. Keep in mind that when enabling this feature flag, you
might experience breaking changes when updating compiler versions.

Currently, enabling this feature flag will make the optimized `aarch64` implementation available.

## License

This project is licensed under either of
Expand Down
27 changes: 27 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
use std::{env, process::Command};

fn main() {
if let Some(minor_version) = minor_rustc_version() {
// rustc 1.80 stabilized ARM CRC32 intrinsics:
// https://doc.rust-lang.org/nightly/core/arch/aarch64/fn.__crc32d.html
if minor_version >= 80 {
println!("cargo:rustc-cfg=stable_arm_crc32_intrinsics");
println!("cargo:rustc-check-cfg=cfg(stable_arm_crc32_intrinsics)");
}
}
}

fn minor_rustc_version() -> Option<u32> {
Command::new(env::var_os("RUSTC")?)
.arg("--version")
.output()
.ok()
.and_then(|output| {
std::str::from_utf8(&output.stdout).ok().and_then(|output| {
output
.split('.')
.nth(1)
.and_then(|minor_version| minor_version.parse().ok())
})
})
}
2 changes: 1 addition & 1 deletion src/specialized/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cfg_if! {
))] {
mod pclmulqdq;
pub use self::pclmulqdq::State;
} else if #[cfg(all(feature = "nightly", target_arch = "aarch64"))] {
} else if #[cfg(all(stable_arm_crc32_intrinsics, target_arch = "aarch64"))] {
mod aarch64;
pub use self::aarch64::State;
} else {
Expand Down