Commit 5ce02c32 authored by Niels Möller's avatar Niels Möller

Two-way unrolling of aligned memxor3.

parent b6a47ff5
......@@ -2,6 +2,7 @@
* memxor.c (memxor_common_alignment, memxor_different_alignment)
(memxor): Change loop order, iterate from the end.
(memxor3_common_alignment): Unroll twice.
* examples/nettle-benchmark.c (time_memxor): Allocate buffers as
arrays of unsigned long, for more reliable alignment.
......
......@@ -166,8 +166,17 @@ memxor3_common_alignment (word_t *dst,
const word_t *a, const word_t *b, size_t n)
{
/* FIXME: Require n > 0? */
while (n-- > 0)
dst[n] = a[n] ^ b[n];
if (n & 1)
{
n--;
dst[n] = a[n] ^ b[n];
}
while (n > 0)
{
n -= 2;
dst[n+1] = a[n+1] ^ b[n+1];
dst[n] = a[n] ^ b[n];
}
}
static void
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment