diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-03-18 10:43:46 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-03-18 10:43:46 -0400 |
commit | aaa33f144c4ad0db0c067df2f6703790be400acb (patch) | |
tree | 1b8f954a3c35d47911fc6ffd4549d0d698eb816b /src/ext | |
parent | 204f7255f4c06fe12d99e785b91ea2fb18047018 (diff) | |
download | tor-aaa33f144c4ad0db0c067df2f6703790be400acb.tar.gz tor-aaa33f144c4ad0db0c067df2f6703790be400acb.zip |
csiphash: don't attempt unaligned access
In digestmap_set/get benchmarks, doing unaligned access on x86
doesn't save more than a percent or so in the fast case. In the
slow case (where we cross a cache line), it could be pretty
expensive. It also makes ubsan unhappy.
Diffstat (limited to 'src/ext')
-rw-r--r-- | src/ext/csiphash.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ext/csiphash.c b/src/ext/csiphash.c index 4f58c4a141..2a96f28815 100644 --- a/src/ext/csiphash.c +++ b/src/ext/csiphash.c @@ -81,11 +81,16 @@ HALF_ROUND(v0,v1,v2,v3,13,16); \ HALF_ROUND(v2,v1,v0,v3,17,21); +#if 0 +/* This does not seem to save very much runtime in the fast case, and it's + * potentially a big loss in the slow case where we're misaligned and we cross + * a cache line. */ #if (defined(__i386) || defined(__i386__) || defined(_M_IX86) || \ defined(__x86_64) || defined(__x86_64__) || \ defined(_M_AMD64) || defined(_M_X64) || defined(__INTEL__)) # define UNALIGNED_OK 1 #endif +#endif uint64_t siphash24(const void *src, unsigned long src_sz, const struct sipkey *key) { uint64_t k0 = key->k0; |