X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flibelogind%2Fsd-bus%2Fbus-bloom.c;h=c0c5d445eb265566d869625d402ed78841390890;hb=94c5f7fa9e34517edad75cd63d71dd459ec4f133;hp=91fab90cb0b8a2e4bda5432af88b6a1684aab32b;hpb=3b22396a4b2767a98172f6915929c47738cb0a1e;p=elogind.git diff --git a/src/libelogind/sd-bus/bus-bloom.c b/src/libelogind/sd-bus/bus-bloom.c index 91fab90cb..c0c5d445e 100644 --- a/src/libelogind/sd-bus/bus-bloom.c +++ b/src/libelogind/sd-bus/bus-bloom.c @@ -19,9 +19,9 @@ along with systemd; If not, see . ***/ -#include "util.h" -#include "siphash24.h" #include "bus-bloom.h" +#include "siphash24.h" +#include "util.h" static inline void set_bit(uint64_t filter[], unsigned long b) { filter[b >> 6] |= 1ULL << (b & 63); @@ -45,7 +45,7 @@ static void bloom_add_data( const void *data, /* Data to hash */ size_t n) { /* Size of data to hash in bytes */ - uint8_t h[8]; + uint64_t h; uint64_t m; unsigned w, i, c = 0; unsigned hash_index; @@ -72,11 +72,11 @@ static void bloom_add_data( for (d = 0; d < w; d++) { if (c <= 0) { - siphash24(h, data, n, hash_keys[hash_index++].bytes); + h = siphash24(data, n, hash_keys[hash_index++].bytes); c += 8; } - p = (p << 8ULL) | (uint64_t) h[8 - c]; + p = (p << 8ULL) | (uint64_t) ((uint8_t *)&h)[8 - c]; c--; }