commit | 73fdf1d3cd028027565e6b7d0e7294aae9afa2fa | [log] [tgz] |
---|---|---|
author | Yi Kong <yikong@google.com> | Fri Feb 26 22:20:50 2021 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Fri Feb 26 22:20:50 2021 +0000 |
tree | ba244353cf43036e252ff3b150c03049b09c8229 | |
parent | 8f45fd47442d95a14a8694054b5060c816c87e11 [diff] | |
parent | f77f0ec2bc391138ece17f007a52baee80134795 [diff] |
Import crc32fast-1.2.1 am: 9f04d26dc4 am: 43aced41b9 am: 467ec3265a am: f77f0ec2bc Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/crc32fast/+/1587991 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: Icf29c8fefa21552cebd5a3c9263ae93a27cde592
Fast, SIMD-accelerated CRC32 (IEEE) checksum computation
extern crate crc32fast; use crc32fast::Hasher; let mut hasher = Hasher::new(); hasher.update(b"foo bar baz"); let checksum = hasher.finalize();
This crate contains multiple CRC32 implementations:
x86
using sse
and pclmulqdq
instructionsaarch64
using crc32
instructionsCalling the Hasher::new
constructor at runtime will perform a feature detection to select the most optimal implementation for the current CPU feature set.
crate | version | variant | ns/iter | MB/s |
---|---|---|---|---|
crc | 1.8.1 | n/a | 4,926 | 207 |
crc32fast (this crate) | 1.0.0 | baseline | 683 | 1499 |
crc32fast (this crate) | 1.0.0 | pclmulqdq | 140 | 7314 |
Due to the use of SIMD intrinsics for the optimized implementations, this crate contains some amount of unsafe
code.
In order to ensure memory safety, the relevant code has been fuzz tested using afl.rs with millions of iterations in both debug
and release
build settings. You can inspect the test setup in the fuzz
sub-directory, which also has instructions on how to run the tests yourself.
On top of that, every commit is tested using an address sanitizer in CI to catch any out of bounds memory accesses.
Even though neither fuzzing nor sanitization has revealed any safety bugs yet, please don't hesitate to file an issue if you run into any crashes or other unexpected behaviour.
std
(default: enabled)This library supports being built without the Rust std
library, which is useful for low-level use-cases such as embedded where no operating system is available. To build the crate in a no_std
context, disable the default std
feature.
Note: Because runtime CPU feature detection requires OS support, the specialized SIMD implementations will be unavailable when the std
feature is disabled.
nightly
(default: disabled)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.
This project is licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.