Skip to content
This repository has been archived by the owner on Dec 30, 2024. It is now read-only.

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
despiegk committed Oct 27, 2024
1 parent 4205e5a commit e6d960a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions research/datastructures/sync/sync.v
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ pub fn new_buzhash() BuzHash {

// Update the rolling hash with a new byte
[direct_array_access; inline]
pub fn (mut b BuzHash) update(byte u8) u32 {
pub fn (mut b BuzHash) update(b u8) u32 {
if b.full {
old_byte := b.window[b.pos]
b.hash = (b.hash << 1) | (b.hash >> 31) // Rotate left by 1
b.hash ^= b.lookup_table[old_byte]
}

b.hash ^= b.lookup_table[byte]
b.window[b.pos] = byte
b.hash ^= b.lookup_table[b]
b.window[b.pos] = b

b.pos++
if b.pos == window_size {
Expand Down

0 comments on commit e6d960a

Please sign in to comment.