+2014-10-23 Niels Möller <nisse@lysator.liu.se>
+
+ * examples/nettle-benchmark.c (time_memxor): Allocate buffers as
+ arrays of unsigned long, for more reliable alignment.
+
2014-10-22 Niels Möller <nisse@lysator.liu.se>
* configure.ac: Check for getline function.
struct bench_memxor_info
{
- uint8_t *dst;
- const uint8_t *src;
- const uint8_t *other;
+ void *dst;
+ const void *src;
+ const void *other;
};
static void
time_memxor(void)
{
struct bench_memxor_info info;
- uint8_t src[BENCH_BLOCK + sizeof(long)];
- uint8_t other[BENCH_BLOCK + sizeof(long)];
- uint8_t dst[BENCH_BLOCK];
+ unsigned long src[BENCH_BLOCK / sizeof(long) + 2];
+ unsigned long other[BENCH_BLOCK / sizeof(long) + 2];
+ unsigned long dst[BENCH_BLOCK / sizeof(long) + 1];
info.src = src;
info.dst = dst;
display ("memxor", "aligned", sizeof(unsigned long),
time_function(bench_memxor, &info));
- info.src = src + 1;
+ info.src = (const char *) src + 1;
display ("memxor", "unaligned", sizeof(unsigned long),
time_function(bench_memxor, &info));
display ("memxor3", "aligned", sizeof(unsigned long),
time_function(bench_memxor3, &info));
- info.other = other + 1;
+ info.other = (const char *) other + 1;
display ("memxor3", "unaligned01", sizeof(unsigned long),
time_function(bench_memxor3, &info));
- info.src = src + 1;
+ info.src = (const char *) src + 1;
display ("memxor3", "unaligned11", sizeof(unsigned long),
time_function(bench_memxor3, &info));
- info.other = other + 2;
+ info.other = (const char *) other + 2;
display ("memxor3", "unaligned12", sizeof(unsigned long),
time_function(bench_memxor3, &info));
}