metaforce/Runtime/CCRC32.hpp

17 lines
337 B
C++
Raw Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
2015-08-17 19:26:47 +00:00
#include <cstdint>
2018-12-08 05:30:43 +00:00
namespace urde {
2018-12-08 05:30:43 +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];
}
2015-08-17 19:26:47 +00:00
public:
2018-12-08 05:30:43 +00:00
static uint32_t Calculate(const void* data, uint32_t length);
2015-08-17 19:26:47 +00:00
};
2018-12-08 05:30:43 +00:00
} // namespace urde