Skip to content

Commit

Permalink
Mark round() prim_mix_g and increment_offset as inline(always) as thi…
Browse files Browse the repository at this point in the history
…s has a major impact on performance
  • Loading branch information
brycx committed Jan 29, 2019
1 parent 1f49f1a commit 41fe2bb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/hazardous/hash/blake2b.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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.
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 41fe2bb

Please sign in to comment.