]> git.proxmox.com Git - proxmox-backup.git/commitdiff
src/backup/chunker.rs: simplify buzzhash start code
authorDietmar Maurer <dietmar@proxmox.com>
Tue, 19 Feb 2019 11:17:17 +0000 (12:17 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 19 Feb 2019 11:17:17 +0000 (12:17 +0100)
src/backup/chunker.rs

index 6576b37fabbf8a3dd21204b2340451d6dcb22d51..f1014460abb3bd594ac7deb40d2cf3aa6bbcb10f 100644 (file)
@@ -220,13 +220,11 @@ impl Chunker {
 
         let window_len = self.window.len();
 
-        for i in 0..window_len-1 {
+        let mut h: u32 = 0;
+        for i in 0..window_len {
             let byte = self.window[i];
-            self.h ^= BUZHASH_TABLE[(byte as usize)].rotate_left((window_len - (i + 1)) as u32);
+            h = h.rotate_left(1) ^ BUZHASH_TABLE[byte as usize];
         }
-
-        let byte = self.window[window_len-1];
-        self.h ^= BUZHASH_TABLE[(byte as usize)];
     }
 }