From ad1835e87c6d3e67fd4997743333c1c7973e89a4 Mon Sep 17 00:00:00 2001 From: Vurich Date: Wed, 19 Jul 2017 16:21:55 +0200 Subject: [PATCH] Unroll 1 more loop --- ethash/src/compute.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ethash/src/compute.rs b/ethash/src/compute.rs index 21dd0a7c7..0db5200dc 100644 --- a/ethash/src/compute.rs +++ b/ethash/src/compute.rs @@ -397,8 +397,12 @@ fn light_new(block_number: u64) -> Light { for i in 0..num_nodes { let idx = *nodes.get_unchecked_mut(i).as_words().get_unchecked(0) as usize % num_nodes; let mut data = nodes.get_unchecked((num_nodes - 1 + i) % num_nodes).clone(); - for w in 0..NODE_WORDS { - *data.as_words_mut().get_unchecked_mut(w) ^= *nodes.get_unchecked(idx).as_words().get_unchecked(w); + + debug_assert_eq!(NODE_WORDS, 16); + unroll! { + for w in 0..16 { + *data.as_words_mut().get_unchecked_mut(w) ^= *nodes.get_unchecked(idx).as_words().get_unchecked(w); + } } sha3_512(&data.bytes, &mut nodes.get_unchecked_mut(i).bytes); }