* memxor.c (memxor_common_alignment, memxor_different_alignment)
(memxor): Change loop order, iterate from the end.
(memxor3_common_alignment): Unroll twice.
+ (word_t): On x86_64, unconditionally define as uint64_t, to get 64
+ bits also in M$ windows. Replaced all uses of SIZEOF_LONG.
* examples/nettle-benchmark.c (time_memxor): Allocate buffers as
arrays of unsigned long, for more reliable alignment.
/* For uintptr_t */
#include "nettle-types.h"
+#if defined(__x86_64__) || defined(__arch64__)
+/* Including on M$ windows, where unsigned long is only 32 bits */
+typedef uint64_t word_t;
+#else
typedef unsigned long int word_t;
-
-#if SIZEOF_LONG & (SIZEOF_LONG - 1)
-#error Word size must be a power of two
#endif
#define ALIGN_OFFSET(p) ((uintptr_t) (p) % sizeof(word_t))
shl = CHAR_BIT * offset;
shr = CHAR_BIT * (sizeof(word_t) - offset);
- src_word = (const word_t *) ((uintptr_t) src & -SIZEOF_LONG);
+ src_word = (const word_t *) ((uintptr_t) src & -sizeof(word_t));
if (n & 1)
{
shl = CHAR_BIT * offset;
shr = CHAR_BIT * (sizeof(word_t) - offset);
- b_word = (const word_t *) ((uintptr_t) b & -SIZEOF_LONG);
+ b_word = (const word_t *) ((uintptr_t) b & -sizeof(word_t));
if (n & 1)
{
shl = CHAR_BIT * offset;
shr = CHAR_BIT * (sizeof(word_t) - offset);
- a_word = (const word_t *) ((uintptr_t) a & -SIZEOF_LONG);
- b_word = (const word_t *) ((uintptr_t) b & -SIZEOF_LONG);
+ a_word = (const word_t *) ((uintptr_t) a & -sizeof(word_t));
+ b_word = (const word_t *) ((uintptr_t) b & -sizeof(word_t));
if (n & 1)
{
bl = CHAR_BIT * b_offset;
br = CHAR_BIT * (sizeof(word_t) - b_offset);
- a_word = (const word_t *) ((uintptr_t) a & -SIZEOF_LONG);
- b_word = (const word_t *) ((uintptr_t) b & -SIZEOF_LONG);
+ a_word = (const word_t *) ((uintptr_t) a & -sizeof(word_t));
+ b_word = (const word_t *) ((uintptr_t) b & -sizeof(word_t));
if (n & 1)
{