/** * This function hashes an integer value. * * <p>It is crucial to use different hash functions to partition data across machines and the internal partitioning of * data structures. This hash function is intended for partitioning across machines. * * @param code The integer to be hashed. * @return The non-negative hash code for the integer. */ public static int murmurHash(int code) { code *= 0xcc9e2d51; code = Integer.rotateLeft(code, 15); code *= 0x1b873593; code = Integer.rotateLeft(code, 13); code = code * 5 + 0xe6546b64; code ^= 4; code = bitMix(code); if (code >= 0) { return code; } else if (code != Integer.MIN_VALUE) { return -code; } else { return 0; } }
/** * Helper function that creates and scrambles a composite hash for key and namespace. */ private static int compositeHash(Object key, Object namespace) { // create composite key through XOR, then apply some bit-mixing for better distribution of skewed keys. return MathUtils.bitMix(key.hashCode() ^ namespace.hashCode()); }
/** * Helper function that creates and scrambles a composite hash for key and namespace. */ private static int compositeHash(Object key, Object namespace) { // create composite key through XOR, then apply some bit-mixing for better distribution of skewed keys. return MathUtils.bitMix(key.hashCode() ^ namespace.hashCode()); }
/** * Helper function that creates and scrambles a composite hash for key and namespace. */ private static int compositeHash(Object key, Object namespace) { // create composite key through XOR, then apply some bit-mixing for better distribution of skewed keys. return MathUtils.bitMix(key.hashCode() ^ namespace.hashCode()); }
/** * Helper function that creates and scrambles a composite hash for key and namespace. */ private static int compositeHash(Object key, Object namespace) { // create composite key through XOR, then apply some bit-mixing for better distribution of skewed keys. return MathUtils.bitMix(key.hashCode() ^ namespace.hashCode()); }
/** * Helper function that creates and scrambles a composite hash for key and namespace. */ private static int compositeHash(Object key, Object namespace) { // create composite key through XOR, then apply some bit-mixing for better distribution of skewed keys. return MathUtils.bitMix(key.hashCode() ^ namespace.hashCode()); }
/** * This function hashes an integer value. * * <p>It is crucial to use different hash functions to partition data across machines and the internal partitioning of * data structures. This hash function is intended for partitioning across machines. * * @param code The integer to be hashed. * @return The non-negative hash code for the integer. */ public static int murmurHash(int code) { code *= 0xcc9e2d51; code = Integer.rotateLeft(code, 15); code *= 0x1b873593; code = Integer.rotateLeft(code, 13); code = code * 5 + 0xe6546b64; code ^= 4; code = bitMix(code); if (code >= 0) { return code; } else if (code != Integer.MIN_VALUE) { return -code; } else { return 0; } }
/** * This function hashes an integer value. * * <p>It is crucial to use different hash functions to partition data across machines and the internal partitioning of * data structures. This hash function is intended for partitioning across machines. * * @param code The integer to be hashed. * @return The non-negative hash code for the integer. */ public static int murmurHash(int code) { code *= 0xcc9e2d51; code = Integer.rotateLeft(code, 15); code *= 0x1b873593; code = Integer.rotateLeft(code, 13); code = code * 5 + 0xe6546b64; code ^= 4; code = bitMix(code); if (code >= 0) { return code; } else if (code != Integer.MIN_VALUE) { return -code; } else { return 0; } }