diff --git a/emory/chunk/find.hpp b/emory/chunk/find.hpp index 64f4aaf..3e54762 100644 --- a/emory/chunk/find.hpp +++ b/emory/chunk/find.hpp @@ -37,6 +37,7 @@ namespace emory::chunk { digest_type const mask = ~digest_type (0) >> (sizeof (digest_type) * 8 - p.bits); u64 hash_state = 0; + static u64 constexpr hash_shift = 1; auto start = src.begin (); // Scan the entire source memory region @@ -54,8 +55,8 @@ namespace emory::chunk { if (cursor < start + p.maximum) { // Rotate the buzhash state if we haven't hit a marker. if (likely (hash_state & mask)) { - hash_state = cruft::rotatel (hash_state, 1) - ^ cruft::rotatel (u64 (*(cursor - p.window)), p.window) + hash_state = cruft::rotatel (hash_state, hash_shift) + ^ cruft::rotatel (u64 (*(cursor - p.window)), p.window * hash_shift) ^ *cursor; continue; }