Struct crc_catalog::Algorithm [−][src]
This struct describes a CRC algorithm using the fields specified by the Catalogue of parametrised CRC algorithms.
Fields
poly: W
The generator polynomial that sets the feedback tap positions of the shift register. The least significant bit corresponds to the inward end of the shift register, and is always set. The highest-order term is omitted.
init: W
The settings of the bit cells at the start of each calculation, before reading the first message bit. The least significant bit corresponds to the inward end of the shift register.
refin: bool
If equal to false
, specifies that the characters of the message are read bit-by-bit, most
significant bit (MSB) first; if equal to true
, the characters are read bit-by-bit, least
significant bit (LSB) first. Each sampled message bit is then XORed with the bit being
simultaneously shifted out of the register at the most significant end, and the result is
passed to the feedback taps.
refout: bool
If equal to false
, specifies that the contents of the register after reading the last
message bit are unreflected before presentation; if equal to true
, it specifies that they
are reflected, character-by-character, before presentation. For the purpose of this
definition, the reflection is performed by swapping the content of each cell with that of
the cell an equal distance from the opposite end of the register; the characters of the CRC
are then true images of parts of the reflected register, the character containing the
original MSB always appearing first.
xorout: W
The XOR value applied to the contents of the register after the last message bit has been read and after the optional reflection. It has the same endianness as the CRC such that its true image appears in the characters of the CRC.
check: W
The contents of the register after initialising, reading the UTF-8 string "123456789"
(as
8-bit characters), optionally reflecting, and applying the final XOR.
residue: W
The contents of the register after initialising, reading an error-free codeword and
optionally reflecting the register (if refout
=true
), but not
applying the final XOR. This is mathematically equivalent to initialising the register with
the xorout parameter, reflecting it as described (if refout
=true
),
reading as many zero bits as there are cells in the register, and reflecting the result (if
refin
=true
). The residue of a crossed-endian model is calculated
assuming that the characters of the received CRC are specially reflected before submitting
the codeword.
Auto Trait Implementations
impl<W> Send for Algorithm<W> where
W: Send,
[src]
W: Send,
impl<W> Sync for Algorithm<W> where
W: Sync,
[src]
W: Sync,
impl<W> Unpin for Algorithm<W> where
W: Unpin,
[src]
W: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,