summaryrefslogtreecommitdiff
path: root/memxor.c
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2014-10-23 13:07:36 +0200
committerNiels Möller <nisse@lysator.liu.se>2014-10-23 13:07:36 +0200
commit5ce02c323b1102c1e603754be5b492d238ee3af7 (patch)
treed70789b9a4a642927c7646bd085325141ab5ad54 /memxor.c
parentb6a47ff58a7831503c6fb53f0820773594fd12d5 (diff)
downloadnettle-5ce02c323b1102c1e603754be5b492d238ee3af7.tar.gz
Two-way unrolling of aligned memxor3.
Diffstat (limited to 'memxor.c')
-rw-r--r--memxor.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/memxor.c b/memxor.c
index e205aba8..0e60e35d 100644
--- a/memxor.c
+++ b/memxor.c
@@ -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