diff options
author | Niels Möller <nisse@lysator.liu.se> | 2014-10-23 13:07:36 +0200 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2014-10-23 13:07:36 +0200 |
commit | 5ce02c323b1102c1e603754be5b492d238ee3af7 (patch) | |
tree | d70789b9a4a642927c7646bd085325141ab5ad54 /memxor.c | |
parent | b6a47ff58a7831503c6fb53f0820773594fd12d5 (diff) | |
download | nettle-5ce02c323b1102c1e603754be5b492d238ee3af7.tar.gz |
Two-way unrolling of aligned memxor3.
Diffstat (limited to 'memxor.c')
-rw-r--r-- | memxor.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -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 |