diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-11-07 01:21:33 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-11-07 01:21:33 +0100 |
commit | 3b1e06256f65d2033ccd57daf68272ca3dfc4a1a (patch) | |
tree | 648844ee427fbc1b3d68ab7844519f07ffdbf9e0 | |
parent | more optimisation (diff) | |
download | libkeccak-3b1e06256f65d2033ccd57daf68272ca3dfc4a1a.tar.gz libkeccak-3b1e06256f65d2033ccd57daf68272ca3dfc4a1a.tar.bz2 libkeccak-3b1e06256f65d2033ccd57daf68272ca3dfc4a1a.tar.xz |
small optimisations to libkeccak_pad10star1
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | src/libkeccak/digest.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/libkeccak/digest.c b/src/libkeccak/digest.c index 3eda69a..cd18138 100644 --- a/src/libkeccak/digest.c +++ b/src/libkeccak/digest.c @@ -260,15 +260,14 @@ int_fast64_t libkeccak_to_lane64(register const char* restrict message, register * `state->M` should have `state->r / 8` bytes left over at the end * @param bits The number of bits in the end of the message that does not make a whole byte */ -static __attribute__((nonnull, nothrow)) -void libkeccak_pad10star1(libkeccak_state_t* restrict state, size_t bits) +static inline __attribute__((nonnull, nothrow, gnu_inline)) +void libkeccak_pad10star1(register libkeccak_state_t* restrict state, register size_t bits) { - /* TODO optimise function */ - size_t r = (size_t)(state->r); - size_t nrf = state->mptr - !!bits; - size_t len = (nrf << 3) | bits; - size_t ll = len % r; - char b = (char)(bits ? (state->M[nrf] | (1 << bits)) : 1); + register size_t r = (size_t)(state->r); + register size_t nrf = state->mptr - !!bits; + register size_t len = (nrf << 3) | bits; + register size_t ll = len % r; + register char b = (char)(bits ? (state->M[nrf] | (1 << bits)) : 1); if ((r - 8 <= ll) && (ll <= r - 2)) { |