aboutsummaryrefslogtreecommitdiff
path: root/reference_impl
diff options
context:
space:
mode:
authorJack O'Connor <[email protected]>2019-12-23 15:47:40 -0600
committerJack O'Connor <[email protected]>2019-12-23 15:47:40 -0600
commit6c1155a41d7b6a268d4daac296c4fd94f7d2273b (patch)
tree6c9cabe0fac4f3580c77e6d10bcbbe26b69315ea /reference_impl
parent3016ddcb3add36e8bbdcf60b06be59b12f22d674 (diff)
get rid of unnecessary variables in push_chunk_chaining_value
Diffstat (limited to 'reference_impl')
-rw-r--r--reference_impl/reference_impl.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/reference_impl/reference_impl.rs b/reference_impl/reference_impl.rs
index 9348fe5..f6b7c8a 100644
--- a/reference_impl/reference_impl.rs
+++ b/reference_impl/reference_impl.rs
@@ -287,7 +287,7 @@ impl Hasher {
self.cv_stack[self.cv_stack_len as usize]
}
- fn push_chunk_chaining_value(&mut self, chunk_cv: [u32; 8], total_chunks: u64) {
+ fn push_chunk_chaining_value(&mut self, mut new_cv: [u32; 8], mut total_chunks: u64) {
// This chunk might complete some subtrees. For each completed subtree,
// `new_cv` will be the right child, and the CV at the top of the CV
// stack will be the left child. Pop the left child off the stack,
@@ -295,11 +295,9 @@ impl Hasher {
// the result. Finally, push `new_cv` onto the CV stack. The number of
// completed subtrees will be the same as the number of trailing 0 bits
// in the total number of chunks so far.
- let mut new_cv = chunk_cv;
- let mut trailing_bit_mask = 1;
- while total_chunks & trailing_bit_mask == 0 {
+ while total_chunks & 1 == 0 {
new_cv = parent_cv(self.pop_stack(), new_cv, self.key, self.chunk_state.flags);
- trailing_bit_mask <<= 1;
+ total_chunks >>= 1;
}
self.push_stack(new_cv);
}