1 unstable release
new 0.3.0 | Oct 21, 2024 |
---|
#2029 in Hardware support
68 downloads per month
7KB
crc16-teledisk-fast
SIMD implementation of CRC-16/TELEDISK, with table and loop fallbacks.
This crate was generated by crc-fast-rs.
Principle of operation
TL;DR: uses SIMD if available, otherwise falls back seamlessly to a lookup table algorithm.
- If using
hash
, will use SIMD if the CPU is capable Currently, x86-64 CPU:s with the following CPU flags are supported:pclmulqdq
sse4.1
- If using
hash
with an incompatible CPU the fallback algorithm will be invoked. If thetable-fallback
feature is active the fallback is based on a lookup table, otherwise a simple loop (slowest option). Deactivatingtable-fallback
(default enabled) can be useful when memory is very scarce, as the lookup table requires a small amount of extra RAM. - If
table-fallback
feature is enabled, it can be manually invoked byhash_table
(not recommended in the typical case). - Similarly,
hash_simple
can be used to force the loop algorithm (also not recommended in the typical case).
Usage
let res: u32 = crc16_teledisk_fast::hash(&my_binary_slice);
There is no "update"-like functionality yet, since doing this with arbitrarily lengths can be tricky with SIMD and destroy performance.
Dependencies
~37KB