This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// CRC tables, generated at compile time using C++11 constexpr, C++14 utility library, variadic template, initializer list | |
// Compiled and tested using msvc 2015, gcc 6.2, and clang 3.9.0. | |
// clang requires -std=c++14 -ftemplate-depth=512 | |
#include <stdint.h> | |
#include <utility> | |
template<typename T, T Poly> | |
struct CrcTable { | |
static constexpr T Generate(T v, int r = 8) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
constexpr unsigned int crc32_table[] = { | |
0, 0x77073096, 0xEE0E612C, 0x990951BA, | |
0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, | |
0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, | |
0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, | |
0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, | |
0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, | |
0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, | |
0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, | |
0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, |