/* This file is based on the public domain MurmurHash3 from Austin Appleby:
*
* We use only the 32 bit variant because the 2 produce different result while
* we need to produce the same result regardless of the architecture as
* clients can be both 64 or 32 bit at the same time.
*/
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include "config.h"
#include "util/murmurhash3.h"
#include "util/sss_endian.h"
{
return (x << r) | (x >> (32 - r));
}
/* slower than original but is endian neutral and handles platforms that
* do only aligned reads */
{
uint32_t r;
return le32toh(r);
}
/*
* Finalization mix - force all bits of a hash block to avalanche
*/
{
h ^= h >> 16;
h *= 0x85ebca6b;
h ^= h >> 13;
h *= 0xc2b2ae35;
h ^= h >> 16;
return h;
}
{
int nblocks;
int i;
c1 = 0xcc9e2d51;
c2 = 0x1b873593;
/* body */
for (i = 0; i < nblocks; i++) {
}
/* tail */
k1 = 0;
switch (len & 3) {
case 3:
case 2:
case 1:
default:
break;
}
/* finalization */
return h1;
}