pub struct CrcParams {
pub algorithm: CrcAlgorithm,
pub name: &'static str,
pub width: u8,
pub poly: u64,
pub init: u64,
pub refin: bool,
pub refout: bool,
pub xorout: u64,
pub check: u64,
pub keys: CrcKeysStorage,
}Expand description
Parameters for CRC computation, including polynomial, initial value, and other settings.
Fields§
§algorithm: CrcAlgorithm§name: &'static str§width: u8§poly: u64§init: u64§refin: bool§refout: bool§xorout: u64§check: u64§keys: CrcKeysStorageImplementations§
Source§impl CrcParams
impl CrcParams
Sourcepub fn new(
name: &'static str,
width: u8,
poly: u64,
init: u64,
reflected: bool,
xorout: u64,
check: u64,
) -> Self
pub fn new( name: &'static str, width: u8, poly: u64, init: u64, reflected: bool, xorout: u64, check: u64, ) -> Self
Creates custom CRC parameters for a given set of Rocksoft CRC parameters.
Uses an internal cache to avoid regenerating folding keys for identical parameter sets. The first call with a given set of parameters will generate and cache the keys, while subsequent calls with the same parameters will use the cached keys for optimal performance.
Does not support mis-matched refin/refout parameters, so both must be true or both false.
Rocksoft parameters for lots of variants: https://reveng.sourceforge.io/crc-catalogue/all.htm
Sourcepub fn get_key(self, index: usize) -> u64
pub fn get_key(self, index: usize) -> u64
Gets a key at the specified index, returning 0 if out of bounds. This provides safe access regardless of internal key storage format.
Sourcepub fn get_key_checked(self, index: usize) -> Option<u64>
pub fn get_key_checked(self, index: usize) -> Option<u64>
Gets a key at the specified index, returning None if out of bounds. This provides optional key access for cases where bounds checking is needed.