CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
cms::CRC32Calculator Class Reference

#include <CRC32Calculator.h>

Public Member Functions

std::uint32_t checksum ()
 
 CRC32Calculator (std::string const &message)
 

Private Attributes

std::uint32_t checksum_
 

Detailed Description

Definition at line 62 of file CRC32Calculator.h.

Constructor & Destructor Documentation

cms::CRC32Calculator::CRC32Calculator ( std::string const &  message)

Definition at line 46 of file CRC32Calculator.cc.

References checksum_, dqmiolumiharvest::j, and AlCaHLTBitMon_ParallelJobs::p.

46  {
47  /* initialize value */
48  checksum_ = CRC32_XINIT;
49 
50  /* process each byte prior to checksum field */
51  auto length = message.length();
52  char const* p = message.data();
53  for (size_t j = 0; j < length; j++) {
54  unsigned char uc = *p++;
55  checksum_ = cms::crctable[(checksum_ ^ uc) & 0xFFL] ^ (checksum_ >> 8);
56  }
57 
58  /* return XOR out value */
59  checksum_ = checksum_ ^ CRC32_XOROT;
60  }
std::uint32_t checksum_

Member Function Documentation

std::uint32_t cms::CRC32Calculator::checksum ( )
inline

Member Data Documentation

std::uint32_t cms::CRC32Calculator::checksum_
private

Definition at line 69 of file CRC32Calculator.h.

Referenced by checksum(), and CRC32Calculator().