]> git.lizzy.rs Git - rust.git/commitdiff
siphash: Remove one variable
authorUlrik Sverdrup <bluss@users.noreply.github.com>
Sat, 25 Jul 2015 09:57:02 +0000 (11:57 +0200)
committerUlrik Sverdrup <bluss@users.noreply.github.com>
Sat, 25 Jul 2015 10:26:18 +0000 (12:26 +0200)
Without this temporary variable, codegen improves slightly and less
registers are spilled to the stack in SipHash::write.

src/libcore/hash/sip.rs

index fae14da22c4c61677c520887e4ad15db27f1be4f..5b6fd46f677afa7510ac7041a19f37a63b89c2d3 100644 (file)
@@ -161,11 +161,10 @@ fn write(&mut self, msg: &[u8]) {
 
         // Buffered tail is now flushed, process new input.
         let len = length - needed;
-        let end = len & (!0x7);
         let left = len & 0x7;
 
         let mut i = needed;
-        while i < end {
+        while i < len - left {
             let mi = unsafe { load_u64_le(msg, i) };
 
             self.v3 ^= mi;