From 41fe2bb1c5d80c9176412fcdfa858778f9580a78 Mon Sep 17 00:00:00 2001 From: brycx Date: Tue, 29 Jan 2019 20:30:25 +0100 Subject: [PATCH] Mark round() prim_mix_g and increment_offset as inline(always) as this has a major impact on performance --- src/hazardous/hash/blake2b.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hazardous/hash/blake2b.rs b/src/hazardous/hash/blake2b.rs index c93e6e94..675ef705 100644 --- a/src/hazardous/hash/blake2b.rs +++ b/src/hazardous/hash/blake2b.rs @@ -202,7 +202,7 @@ impl core::fmt::Debug for Blake2b { } impl Blake2b { - #[inline] + #[inline(always)] /// Increment the internal states offset value `t`. fn increment_offset(&mut self, value: u64) { self.t[0] += value; @@ -211,7 +211,7 @@ impl Blake2b { } } - #[inline] + #[inline(always)] #[allow(clippy::many_single_char_names)] #[allow(clippy::too_many_arguments)] /// The primitive mixing function G as defined in the RFC. @@ -239,7 +239,7 @@ impl Blake2b { w[b] = (w[b]).rotate_right(63u32); } - #[inline] + #[inline(always)] /// Perform a single round based on a message schedule selection. fn round(&mut self, ri: usize, m: &mut [u64], w: &mut [u64]) { self.prim_mix_g(m[SIGMA[ri][0]], m[SIGMA[ri][1]], 0, 4, 8, 12, w);