Commit dac00f57 authored by Niels Möller's avatar Niels Möller
Browse files

Use unsigned long arrays for memxor benchmark.

parent 94269a22
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> 2014-10-22 Niels Möller <nisse@lysator.liu.se>
* configure.ac: Check for getline function. * configure.ac: Check for getline function.
......
...@@ -157,9 +157,9 @@ bench_nothing(void *arg UNUSED) ...@@ -157,9 +157,9 @@ bench_nothing(void *arg UNUSED)
struct bench_memxor_info struct bench_memxor_info
{ {
uint8_t *dst; void *dst;
const uint8_t *src; const void *src;
const uint8_t *other; const void *other;
}; };
static void static void
...@@ -345,16 +345,16 @@ static void ...@@ -345,16 +345,16 @@ static void
time_memxor(void) time_memxor(void)
{ {
struct bench_memxor_info info; struct bench_memxor_info info;
uint8_t src[BENCH_BLOCK + sizeof(long)]; unsigned long src[BENCH_BLOCK / sizeof(long) + 2];
uint8_t other[BENCH_BLOCK + sizeof(long)]; unsigned long other[BENCH_BLOCK / sizeof(long) + 2];
uint8_t dst[BENCH_BLOCK]; unsigned long dst[BENCH_BLOCK / sizeof(long) + 1];
info.src = src; info.src = src;
info.dst = dst; info.dst = dst;
display ("memxor", "aligned", sizeof(unsigned long), display ("memxor", "aligned", sizeof(unsigned long),
time_function(bench_memxor, &info)); time_function(bench_memxor, &info));
info.src = src + 1; info.src = (const char *) src + 1;
display ("memxor", "unaligned", sizeof(unsigned long), display ("memxor", "unaligned", sizeof(unsigned long),
time_function(bench_memxor, &info)); time_function(bench_memxor, &info));
...@@ -363,13 +363,13 @@ time_memxor(void) ...@@ -363,13 +363,13 @@ time_memxor(void)
display ("memxor3", "aligned", sizeof(unsigned long), display ("memxor3", "aligned", sizeof(unsigned long),
time_function(bench_memxor3, &info)); time_function(bench_memxor3, &info));
info.other = other + 1; info.other = (const char *) other + 1;
display ("memxor3", "unaligned01", sizeof(unsigned long), display ("memxor3", "unaligned01", sizeof(unsigned long),
time_function(bench_memxor3, &info)); time_function(bench_memxor3, &info));
info.src = src + 1; info.src = (const char *) src + 1;
display ("memxor3", "unaligned11", sizeof(unsigned long), display ("memxor3", "unaligned11", sizeof(unsigned long),
time_function(bench_memxor3, &info)); time_function(bench_memxor3, &info));
info.other = other + 2; info.other = (const char *) other + 2;
display ("memxor3", "unaligned12", sizeof(unsigned long), display ("memxor3", "unaligned12", sizeof(unsigned long),
time_function(bench_memxor3, &info)); time_function(bench_memxor3, &info));
} }
......
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