File indexing completed on 2024-04-06 12:13:13
0001 #include "FWCore/Utilities/interface/Adler32Calculator.h"
0002
0003 namespace cms {
0004
0005
0006
0007
0008
0009
0010 void Adler32(char const* data, size_t len, uint32_t& a, uint32_t& b) {
0011
0012
0013 #define MOD_ADLER 65521
0014
0015 unsigned char const* ptr = static_cast<unsigned char const*>(static_cast<void const*>(data));
0016 while (len > 0) {
0017 size_t tlen = (len > 5552 ? 5552 : len);
0018 len -= tlen;
0019 do {
0020 a += *ptr++;
0021 b += a;
0022 } while (--tlen);
0023
0024 a %= MOD_ADLER;
0025 b %= MOD_ADLER;
0026 }
0027
0028 #undef MOD_ADLER
0029 }
0030
0031 uint32_t Adler32(char const* data, size_t len) {
0032
0033 uint32_t a = 1, b = 0;
0034 Adler32(data, len, a, b);
0035 return (b << 16) | a;
0036 }
0037 }