From dbe81cbd2a93088236a2e4e41eeb33378940f7b9 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 16 Nov 2015 09:21:20 +0100 Subject: siphash24: change result argument to uint64_t Change the "out" parameter from uint8_t[8] to uint64_t. On architectures which enforce pointer alignment this fixes crashes when we previously cast an unaligned array to uint64_t*, and on others this should at least improve performance as the compiler now aligns these properly. This also simplifies the code in most cases by getting rid of typecasts. The only place which we can't change is struct duid's en.id, as that is _packed_ and public API, so we can't enforce alignment of the "id" field and have to use memcpy instead. --- src/basic/hashmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/basic/hashmap.c') diff --git a/src/basic/hashmap.c b/src/basic/hashmap.c index 4109a08c6c..d88ceb40aa 100644 --- a/src/basic/hashmap.c +++ b/src/basic/hashmap.c @@ -380,7 +380,7 @@ static unsigned base_bucket_hash(HashmapBase *h, const void *p) { h->hash_ops->hash(p, &state); - siphash24_finalize((uint8_t*)&hash, &state); + siphash24_finalize(&hash, &state); return (unsigned) (hash % n_buckets(h)); } -- cgit v1.2.3-54-g00ecf