Template Struct CRC32Table
Defined in File crc32.hpp
Struct Documentation
-
template<size_t Polynomial, size_t NumTables>
struct CRC32Table Compute CRC32 lookup tables as described at: https://github.com/komrad36/CRC#option-6-1-byte-tabular
An iteration of CRC computation can be performed on 8 bits of input at once. By pre-computing a table of the values of CRC(?) for all 2^8 = 256 possible byte values, during the final computation we can replace a loop over 8 bits with a single lookup in the table.
For further speedup, we can also pre-compute the values of CRC(?0) for all possible bytes when a zero byte is appended. Then we can process two bytes of input at once by computing CRC(AB) = CRC(A0) ^ CRC(B), using one lookup in the CRC(?0) table and one lookup in the CRC(?) table.
The same technique applies for any number of bytes to be processed at once, although the speed improvements diminish.
- Param Polynomial:
The binary representation of the polynomial to use (reversed, i.e. most significant bit represents x^0).
- Param NumTables:
The number of bytes of input that will be processed at once.