pub struct Polynomial(/* private fields */);
Expand description
A CRC polynomial.
The STM32H7 CRC unit only supports odd polynomials, and the constructors
will check to ensure the polynomial is odd unless the _unchecked
variants
are used.
Even polynomials are essentially never used in CRCs, so you most likely don’t need to worry about this if you aren’t creating your own algorithm.
A polynomial being even means that the least significant bit is 0
in the polynomial’s normal representation.
Implementations§
Source§impl Polynomial
impl Polynomial
Sourcepub fn bits7(poly: u8) -> Result<Self>
pub fn bits7(poly: u8) -> Result<Self>
Create a 7-bit polynomial. Returns an error if the polynomial passed has the MSB set or is even.
Sourcepub fn bits8(poly: u8) -> Result<Self>
pub fn bits8(poly: u8) -> Result<Self>
Create an 8-bit polynomial. Returns an error if the polynomial passed is even.
Sourcepub fn bits16(poly: u16) -> Result<Self>
pub fn bits16(poly: u16) -> Result<Self>
Create a 16-bit polynomial. Returns an error if the polynomial passed is even.
Sourcepub fn bits32(poly: u32) -> Result<Self>
pub fn bits32(poly: u32) -> Result<Self>
Create a 32-bit polynomial. Returns an error if the polynomial passed is even.
Sourcepub const fn bits7_unchecked(poly: u8) -> Self
pub const fn bits7_unchecked(poly: u8) -> Self
Create a 7-bit polynomial. If the polynomial passed is even the CRC unit will give incorrect results.
Sourcepub const fn bits8_unchecked(poly: u8) -> Self
pub const fn bits8_unchecked(poly: u8) -> Self
Create an 8-bit polynomial. If the polynomial passed is even the CRC unit will give incorrect results.
Sourcepub const fn bits16_unchecked(poly: u16) -> Self
pub const fn bits16_unchecked(poly: u16) -> Self
Create a 16-bit polynomial. If the polynomial passed is even the CRC unit will give incorrect results.
Sourcepub const fn bits32_unchecked(poly: u32) -> Self
pub const fn bits32_unchecked(poly: u32) -> Self
Create a 32-bit polynomial. If the polynomial passed is even the CRC unit will give incorrect results.
Trait Implementations§
Source§impl Clone for Polynomial
impl Clone for Polynomial
Source§fn clone(&self) -> Polynomial
fn clone(&self) -> Polynomial
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more