Index: b/Python/pyhash.c =================================================================== --- a/Python/pyhash.c +++ b/Python/pyhash.c @@ -328,20 +328,21 @@ static PyHash_FuncDef PyHash_Func = {fnv * the hash values' least significant bits. */ #if PY_LITTLE_ENDIAN -# define _le64toh(x) ((uint64_t)(x)) +# define _le64toh(v, x) memcpy(&v, x, sizeof(v)) #elif defined(__APPLE__) -# define _le64toh(x) OSSwapLittleToHostInt64(x) +# define _le64toh(v, x) v = OSSwapLittleToHostInt64(*x) #elif defined(HAVE_LETOH64) -# define _le64toh(x) le64toh(x) +# define _le64toh(v, x) v = le64toh(*x) #else -# define _le64toh(x) (((uint64_t)(x) << 56) | \ - (((uint64_t)(x) << 40) & 0xff000000000000ULL) | \ - (((uint64_t)(x) << 24) & 0xff0000000000ULL) | \ - (((uint64_t)(x) << 8) & 0xff00000000ULL) | \ - (((uint64_t)(x) >> 8) & 0xff000000ULL) | \ - (((uint64_t)(x) >> 24) & 0xff0000ULL) | \ - (((uint64_t)(x) >> 40) & 0xff00ULL) | \ - ((uint64_t)(x) >> 56)) +# define _le64toh(v, x) v = \ + (((uint64_t)(*x) << 56) | \ + (((uint64_t)(*x) << 40) & 0xff000000000000ULL) | \ + (((uint64_t)(*x) << 24) & 0xff0000000000ULL) | \ + (((uint64_t)(*x) << 8) & 0xff00000000ULL) | \ + (((uint64_t)(*x) >> 8) & 0xff000000ULL) | \ + (((uint64_t)(*x) >> 24) & 0xff0000ULL) | \ + (((uint64_t)(*x) >> 40) & 0xff00ULL) | \ + ((uint64_t)(*x) >> 56)) #endif @@ -381,7 +382,8 @@ siphash24(const void *src, Py_ssize_t sr uint8_t *m; while (src_sz >= 8) { - uint64_t mi = _le64toh(*in); + uint64_t mi; + _le64toh(mi, in); in += 1; src_sz -= 8; v3 ^= mi;