Struct crc_catalog::Algorithm[][src]

pub struct Algorithm<W: Width> {
    pub poly: W,
    pub init: W,
    pub refin: bool,
    pub refout: bool,
    pub xorout: W,
    pub check: W,
    pub residue: W,
}

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]

impl<W> Sync for Algorithm<W> where
    W: Sync
[src]

impl<W> Unpin for Algorithm<W> where
    W: Unpin
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.