25#define DO1(buf,i) {s1 += buf[i]; s2 += s1;}
26#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1);
27#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2);
28#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4);
29#define DO16(buf) DO8(buf,0); DO8(buf,8);
31void RollsumUpdate(
Rollsum *sum,
const unsigned char *buf,
size_t len)
36 uint_fast16_t s1 = sum->
s1;
37 uint_fast16_t s2 = sum->
s2;
50 s1 += (uint_fast16_t)len * ROLLSUM_CHAR_OFFSET;
51 s2 += (uint_fast16_t)((len * (len + 1)) / 2) * ROLLSUM_CHAR_OFFSET;
The Rollsum class implementation of the original rsync rollsum.
size_t count
count of bytes included in sum
uint_fast16_t s1
s1 part of sum
uint_fast16_t s2
s2 part of sum