hash/crc: document template parameters
This commit is contained in:
parent
bec24535fc
commit
f4093cb3d5
@ -173,6 +173,9 @@ util::hash::crc<
|
|||||||
DigestT,Generator,Initial,Final,ReflectIn,ReflectOut
|
DigestT,Generator,Initial,Final,ReflectIn,ReflectOut
|
||||||
>::table (void)
|
>::table (void)
|
||||||
{
|
{
|
||||||
|
// We want to use a std::array here for a (slight) safety advantage, but
|
||||||
|
// it means that we have to use calls to array::data instead of operator[]
|
||||||
|
// to retain constexpr.
|
||||||
std::array<digest_t,256> values {};
|
std::array<digest_t,256> values {};
|
||||||
|
|
||||||
if (ReflectIn) {
|
if (ReflectIn) {
|
||||||
|
10
hash/crc.hpp
10
hash/crc.hpp
@ -29,6 +29,16 @@ namespace util { namespace hash {
|
|||||||
//
|
//
|
||||||
// Adapted from the PNG specification (ISO/IEC 15948:2003), appendix D and
|
// Adapted from the PNG specification (ISO/IEC 15948:2003), appendix D and
|
||||||
// the public domain implementation of Ross Williams.
|
// the public domain implementation of Ross Williams.
|
||||||
|
//
|
||||||
|
// Generator: the polynomial, with the leading (ie, 32nd) high bit truncated.
|
||||||
|
// Initial: value used to initialise the digest
|
||||||
|
// Final: value to xor against the digest at finish time
|
||||||
|
// ReflectIn: whether to reverse the bits of each data byte
|
||||||
|
// ReflectOut: whether to reverse the bits of the digest at finish time
|
||||||
|
//
|
||||||
|
// Note that reflection isn't necessarily explicitly performed at update
|
||||||
|
// time. Instead we construct the lookup table appropriately to directly
|
||||||
|
// use the data values directly.
|
||||||
template <
|
template <
|
||||||
typename DigestT,
|
typename DigestT,
|
||||||
DigestT Generator,
|
DigestT Generator,
|
||||||
|
Loading…
Reference in New Issue
Block a user