mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-17 16:31:27 -04:00
Use unsigned bytes in cyclic hash
This commit is contained in:
parent
3dd82bc085
commit
5046930d17
@ -32,13 +32,13 @@ class rsync_hash {
|
|||||||
|
|
||||||
uint32_t operator()() const { return a_ | (uint32_t(b_) << 16); }
|
uint32_t operator()() const { return a_ | (uint32_t(b_) << 16); }
|
||||||
|
|
||||||
void update(int8_t inbyte) {
|
void update(uint8_t inbyte) {
|
||||||
a_ += inbyte;
|
a_ += inbyte;
|
||||||
b_ += a_;
|
b_ += a_;
|
||||||
++len_;
|
++len_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void update(int8_t outbyte, int8_t inbyte) {
|
void update(uint8_t outbyte, uint8_t inbyte) {
|
||||||
a_ = a_ - outbyte + inbyte;
|
a_ = a_ - outbyte + inbyte;
|
||||||
b_ -= len_ * outbyte;
|
b_ -= len_ * outbyte;
|
||||||
b_ += a_;
|
b_ += a_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user