openMSX
Public Member Functions | List of all members
openmsx::CRC16 Class Reference

This class calculates CRC numbers for the polygon x^16 + x^12 + x^5 + 1. More...

#include <CRC16.hh>

Public Member Functions

constexpr CRC16 (uint16_t initialCRC=0xffff)
 Create CRC16 with an optional initial value.
 
constexpr void init (uint16_t initialCRC)
 (Re)initialize the current value
 
constexpr void init (std::initializer_list< uint8_t > list)
 
constexpr void update (uint8_t value)
 Update CRC with one byte.
 
constexpr void update (std::span< const uint8_t > data)
 For large blocks (e.g.
 
constexpr uint16_t getValue () const
 Get current CRC value.
 

Detailed Description

This class calculates CRC numbers for the polygon x^16 + x^12 + x^5 + 1.

Definition at line 18 of file CRC16.hh.

Constructor & Destructor Documentation

◆ CRC16()

constexpr openmsx::CRC16::CRC16 ( uint16_t  initialCRC = 0xffff)
inlineexplicitconstexpr

Create CRC16 with an optional initial value.

Definition at line 23 of file CRC16.hh.

Member Function Documentation

◆ getValue()

constexpr uint16_t openmsx::CRC16::getValue ( ) const
inlineconstexpr

◆ init() [1/2]

constexpr void openmsx::CRC16::init ( std::initializer_list< uint8_t >  list)
inlineconstexpr

Definition at line 35 of file CRC16.hh.

References update().

◆ init() [2/2]

constexpr void openmsx::CRC16::init ( uint16_t  initialCRC)
inlineconstexpr

(Re)initialize the current value

Definition at line 30 of file CRC16.hh.

Referenced by openmsx::TC8566AF::serialize(), openmsx::WD2793::serialize(), and TEST_CASE().

◆ update() [1/2]

constexpr void openmsx::CRC16::update ( std::span< const uint8_t >  data)
inlineconstexpr

For large blocks (e.g.

512 bytes) this routine is approx 5x faster than calling the method above in a loop.

Definition at line 54 of file CRC16.hh.

◆ update() [2/2]

constexpr void openmsx::CRC16::update ( uint8_t  value)
inlineconstexpr

Update CRC with one byte.

Definition at line 45 of file CRC16.hh.

Referenced by openmsx::WD2793::getDataReg(), init(), TEST_CASE(), and openmsx::RawTrack::updateCrc().


The documentation for this class was generated from the following file: