X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fsiphash%2Fsiphash.c;h=7f6706caf435fff60dfe775d7ca8f21fa0f3c691;hp=93eac040fc14b9181b00785adb829076de346718;hb=bbfec6b1b466bf0000b47eb33f2c624871e0dbd2;hpb=480b3117c39b91fcb6d39c60222232b7608f5507 diff --git a/ccan/siphash/siphash.c b/ccan/siphash/siphash.c index 93eac040..7f6706ca 100644 --- a/ccan/siphash/siphash.c +++ b/ccan/siphash/siphash.c @@ -2,6 +2,8 @@ #include +#include + #include "siphash.h" typedef uint64_t u64; @@ -23,8 +25,13 @@ enum sip_index { A=0, B=2, C=1, D=3, E=4 }; SIP_HALF_ROUND((W)[C], (W)[B], (W)[A], (W)[D], 17, 21); \ } while(0) -/* Load a 64-bit word as little endian */ -#define W64(S,I) (le64_to_cpu(*((u64 *)(S) + (I)))) + +static inline u64 W64(const void *p, size_t I) +{ + uint64_t x; + memcpy(&x, (char *)p + I*sizeof(x), sizeof(x)); + return le64_to_cpu(x); +} static void siphash_init(u64 v[5], const unsigned char key[16]) {