//seed 是大质数
unsigned long long MurmurHash64B ( const void * key, int len, unsigned int seed )
{
const unsigned int m = 0x5bd1e995;
const int r = ; unsigned int h1 = seed ^ len;
unsigned int h2 = ; const unsigned int * data = (const unsigned int *)key; while(len >= )
{
unsigned int k1 = *data++;
k1 *= m; k1 ^= k1 >> r; k1 *= m;
h1 *= m; h1 ^= k1;
len -= ; unsigned int k2 = *data++;
k2 *= m; k2 ^= k2 >> r; k2 *= m;
h2 *= m; h2 ^= k2;
len -= ;
} if(len >= )
{
unsigned int k1 = *data++;
k1 *= m; k1 ^= k1 >> r; k1 *= m;
h1 *= m; h1 ^= k1;
len -= ;
} switch(len)
{
case : h2 ^= ((unsigned char*)data)[] << ;
case : h2 ^= ((unsigned char*)data)[] << ;
case : h2 ^= ((unsigned char*)data)[];
h2 *= m;
}; h1 ^= h2 >> ; h1 *= m;
h2 ^= h1 >> ; h2 *= m;
h1 ^= h2 >> ; h1 *= m;
h2 ^= h1 >> ; h2 *= m; unsigned long long h = h1; h = (h << ) | h2; return h;
}
05-23 02:08