1#ifndef __XRDCKSCALCADLER32_HH__
2#define __XRDCKSCALCADLER32_HH__
34#include <netinet/in.h>
75#define DO1(buf) {unSum1 += *buf++; unSum2 += unSum1;}
76#define DO2(buf) DO1(buf); DO1(buf);
77#define DO4(buf) DO2(buf); DO2(buf);
78#define DO8(buf) DO4(buf); DO4(buf);
79#define DO16(buf) DO8(buf); DO8(buf);
86 {AdlerValue = (unSum2 << 16) | unSum1;
88 AdlerValue = htonl(AdlerValue);
90 return (
char *)&AdlerValue;
93void Init() {unSum1 = AdlerStart; unSum2 = 0;}
97void Update(
const char *Buff,
int BLen)
99 unsigned char *buff = (
unsigned char *)Buff;
101 {k = (BLen < AdlerNMax ? BLen : AdlerNMax);
103 while(k >= 16) {
DO16(buff); k -= 16;}
104 if (k != 0)
do {
DO1(buff);}
while (--k);
105 unSum1 %= AdlerBase; unSum2 %= AdlerBase;
109const char *
Type(
int &csSize) {csSize =
sizeof(AdlerValue);
return "adler32";}
116static const unsigned int AdlerBase = 0xFFF1;
117static const unsigned int AdlerStart = 0x0001;
118static const int AdlerNMax = 5552;
122 unsigned int AdlerValue;
void Update(const char *Buff, int BLen)
const char * Type(int &csSize)
virtual ~XrdCksCalcadler32()