2015-08-17 19:26:47 +00:00
|
|
|
#ifndef RETRO_CRC32_HPP
|
|
|
|
#define RETRO_CRC32_HPP
|
|
|
|
#include <cstdint>
|
|
|
|
|
2015-08-17 22:05:00 +00:00
|
|
|
namespace Retro
|
|
|
|
{
|
|
|
|
namespace Common
|
|
|
|
{
|
|
|
|
|
2015-08-17 19:26:47 +00:00
|
|
|
class CCRC32
|
|
|
|
{
|
|
|
|
static const uint32_t crc32Table[256];
|
|
|
|
static inline uint32_t permute(uint32_t checksum, uint8_t b)
|
|
|
|
{ return (checksum >> 8) ^ crc32Table[(checksum & 0xFF) ^ b]; }
|
|
|
|
|
|
|
|
public:
|
|
|
|
static uint32_t Calculate(const void* data, uint32_t length);
|
|
|
|
};
|
|
|
|
|
2015-08-17 22:05:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-17 19:26:47 +00:00
|
|
|
#endif
|