2 #include <system_error>
5 using namespace scc::encode;
9 if (loc ==
nullptr)
throw std::runtime_error(
"adler32 update called with null");
10 if (len <= 0)
throw std::runtime_error(
"adler32 update called with invalid len");
12 m_val = adler32(m_val,
static_cast<const Bytef*
>(loc), len);
38 if (m_sz == 0)
throw std::runtime_error(
"Cannot rotate with window size 0");
40 uint32_t a = m_val & 0xffff;
41 a = (a - xrem + xadd + MOD) % MOD;
42 uint32_t b = (m_val >> 16) & 0xffff;
43 b = (b - m_sz*xrem + a - 1 + (m_sz*xrem/MOD+1)*MOD) % MOD;
44 m_val = (b << 16) | a;
48 uint32_t Adler32::combine(
const Adler32& add)
50 m_val = adler32_combine(m_val, add.m_val, add.m_sz);
Adler32 rolling checksum.
Adler-32 checksum allowing rolling calculation.
uint32_t rotate(unsigned char, unsigned char)
Update the checksum with next byte.
uint32_t update(const void *, int)
Update the checksum with buffer contents.