aboutsummaryrefslogtreecommitdiffstats
path: root/libblake_internal_blake2b_compress.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2022-01-21 18:29:26 +0100
committerMattias Andrée <maandree@kth.se>2022-01-21 18:29:26 +0100
commit839a3d17d257e73be9bc99dfa90e56c0824050ba (patch)
tree6bb010351447edbb0ae8d910948b01837d2de9e5 /libblake_internal_blake2b_compress.c
parentFix memory corruption bug in test.c and simplify message byte-length calculation (diff)
downloadlibblake-839a3d17d257e73be9bc99dfa90e56c0824050ba.tar.gz
libblake-839a3d17d257e73be9bc99dfa90e56c0824050ba.tar.bz2
libblake-839a3d17d257e73be9bc99dfa90e56c0824050ba.tar.xz
Initial work on optimising compression function; mm128 version is slower, mm256 version is barely faster
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libblake_internal_blake2b_compress.c')
-rw-r--r--libblake_internal_blake2b_compress.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libblake_internal_blake2b_compress.c b/libblake_internal_blake2b_compress.c
index e844180..d04a469 100644
--- a/libblake_internal_blake2b_compress.c
+++ b/libblake_internal_blake2b_compress.c
@@ -1,9 +1,12 @@
/* See LICENSE file for copyright and license details. */
#include "common.h"
+/* This code performs suboptimally if compiled with -mavx2 */
+
static uint_least64_t
decode_uint64_le(const unsigned char *data)
{
+ /* This is perfectly optimised by the compiler */
return (((uint_least64_t)(data[0] & 255)) << 0) |
(((uint_least64_t)(data[1] & 255)) << 8) |
(((uint_least64_t)(data[2] & 255)) << 16) |
@@ -17,6 +20,7 @@ decode_uint64_le(const unsigned char *data)
static uint_least64_t
rotate_right(uint_least64_t x, int n)
{
+ /* This is perfectly optimised by the compiler */
return ((x >> n) | (x << (64 - n))) & UINT_LEAST64_C(0xFFFFffffFFFFffff);
}