openMSX
Classes | 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

 CRC16 (uint16_t initialCRC=0xFFFF)
 Create CRC16 with an optional initial value. More...
 
void init (uint16_t initialCRC)
 (Re)initialize the current value More...
 
template<uint8_t V1>
void init ()
 (Re)initialize with a short initial sequence. More...
 
template<uint8_t V1, uint8_t V2>
void init ()
 
template<uint8_t V1, uint8_t V2, uint8_t V3>
void init ()
 
template<uint8_t V1, uint8_t V2, uint8_t V3, uint8_t V4>
void init ()
 
void update (uint8_t value)
 Update CRC with one byte. More...
 
void update (const uint8_t *data, size_t size)
 For large blocks (e.g. More...
 
uint16_t getValue () const
 Get current CRC value. More...
 

Detailed Description

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

Definition at line 13 of file CRC16.hh.

Constructor & Destructor Documentation

◆ CRC16()

openmsx::CRC16::CRC16 ( uint16_t  initialCRC = 0xFFFF)
inlineexplicit

Create CRC16 with an optional initial value.

Definition at line 18 of file CRC16.hh.

References init().

Member Function Documentation

◆ getValue()

uint16_t openmsx::CRC16::getValue ( ) const
inline

◆ init() [1/5]

void openmsx::CRC16::init ( uint16_t  initialCRC)
inline

◆ init() [2/5]

template<uint8_t V1>
void openmsx::CRC16::init ( )
inline

(Re)initialize with a short initial sequence.

The initial value is guaranteed to be computed at compile time.

Definition at line 33 of file CRC16.hh.

Referenced by CRC16(), and init().

◆ init() [3/5]

template<uint8_t V1, uint8_t V2>
void openmsx::CRC16::init ( )
inline

Definition at line 39 of file CRC16.hh.

References init().

◆ init() [4/5]

template<uint8_t V1, uint8_t V2, uint8_t V3>
void openmsx::CRC16::init ( )
inline

Definition at line 46 of file CRC16.hh.

References init().

◆ init() [5/5]

template<uint8_t V1, uint8_t V2, uint8_t V3, uint8_t V4>
void openmsx::CRC16::init ( )
inline

Definition at line 54 of file CRC16.hh.

References init().

◆ update() [1/2]

void openmsx::CRC16::update ( uint8_t  value)
inline

◆ update() [2/2]

void openmsx::CRC16::update ( const uint8_t *  data,
size_t  size 
)
inline

For large blocks (e.g.

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

Definition at line 75 of file CRC16.hh.

References utf8::unchecked::size().


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