From 25a2ba7383d678307a5cc3a84fc129afb934b129 Mon Sep 17 00:00:00 2001 From: Mathijs van de Nes Date: Tue, 30 Jun 2015 08:54:53 +0200 Subject: [PATCH] Small update to crc32 function --- src/crc32.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crc32.rs b/src/crc32.rs index 9fefa7f9..ec3d2638 100644 --- a/src/crc32.rs +++ b/src/crc32.rs @@ -54,9 +54,9 @@ pub fn update(prev: u32, buf: &[u8]) -> u32 { let mut crc = !prev; - for byte in buf.iter() + for &byte in buf.iter() { - crc = CRC32_TABLE[(crc as u8 ^ *byte) as usize] ^ (crc >> 8); + crc = CRC32_TABLE[((crc as u8) ^ byte) as usize] ^ (crc >> 8); } !crc