optimizations will produce similar instructions anyway
#ifdef HAVE_MURMUR_HASH
+#include <cstring>
+
uint32_t hashkit_murmur(const char *key, size_t length, void *context)
{
/*
while(length >= 4)
{
- unsigned int k = *(unsigned int *)data;
+ unsigned int k;
+ memcpy(&k, data, sizeof(unsigned int));
k *= m;
k ^= k >> r;
// Block read - if your platform needs to do endian-swapping or can only
// handle aligned reads, do the conversion here
-#define getblock(p, i) (p[i])
+#include <cstring>
+template <typename T>
+static inline T getblock(const T *blocks, int i) {
+ T b;
+ memcpy(&b, ((const uint8_t *) blocks) + i * sizeof(T), sizeof(T));
+ return b;
+}
//-----------------------------------------------------------------------------
// Finalization mix - force all bits of a hash block to avalanche