/// <summary> /// Returns the MurmurHash3_x86_32 hash. /// Original source/tests at <a href="https://github.com/yonik/java_util/">https://github.com/yonik/java_util/</a>. /// </summary> public static int Murmurhash3_x86_32(byte[] data, int offset, int len, int seed) { const int c1 = unchecked ((int)0xcc9e2d51); const int c2 = 0x1b873593; int h1 = seed; int roundedEnd = offset + (len & unchecked ((int)0xfffffffc)); // round down to 4 byte block for (int i = offset; i < roundedEnd; i += 4) { // little endian load order int k1 = (((sbyte)data[i]) & 0xff) | ((((sbyte)data[i + 1]) & 0xff) << 8) | ((((sbyte)data[i + 2]) & 0xff) << 16) | (((sbyte)data[i + 3]) << 24); k1 *= c1; k1 = Number.RotateLeft(k1, 15); k1 *= c2; h1 ^= k1; h1 = Number.RotateLeft(h1, 13); h1 = h1 * 5 + unchecked ((int)0xe6546b64); } // tail int k2 = 0; switch (len & 0x03) { case 3: k2 = (((sbyte)data[roundedEnd + 2]) & 0xff) << 16; // fallthrough goto case 2; case 2: k2 |= (((sbyte)data[roundedEnd + 1]) & 0xff) << 8; // fallthrough goto case 1; case 1: k2 |= (((sbyte)data[roundedEnd]) & 0xff); k2 *= c1; k2 = Number.RotateLeft(k2, 15); k2 *= c2; h1 ^= k2; break; } // finalization h1 ^= len; // fmix(h1); h1 ^= (int)((uint)h1 >> 16); h1 *= unchecked ((int)0x85ebca6b); h1 ^= (int)((uint)h1 >> 13); h1 *= unchecked ((int)0xc2b2ae35); h1 ^= (int)((uint)h1 >> 16); return(h1); }
public override int GetHashCode() { int h = base.GetHashCode(); h = Number.RotateLeft(h, 1); h ^= include.GetHashCode(); h = Number.RotateLeft(h, 1); h ^= exclude.GetHashCode(); h = Number.RotateLeft(h, 1); h ^= pre; h = Number.RotateLeft(h, 1); h ^= post; return(h); }