Java Hash Calculate hash(long key)

Here you can find the source of hash(long key)

Description

hash

License

Apache License

Parameter

Parameter Description
key to be hashed

Return

an index into the hash table This hash function is taken from the internals of Austin Appleby's MurmurHash3 algorithm. It is also used by the Trove for Java libraries.

Declaration

static long hash(long key) 

Method Source Code

//package com.java2s;
/*//  www  .j  a  va  2  s .  com
 * Copyright 2016, Yahoo! Inc.
 * Licensed under the terms of the Apache License 2.0. See LICENSE file at the project root for terms.
 */

public class Main {
    /**
     * @param key to be hashed
     * @return an index into the hash table This hash function is taken from the internals of 
     * Austin Appleby's MurmurHash3 algorithm. It is also used by the Trove for Java libraries.
     */
    static long hash(long key) {
        key ^= key >>> 33;
        key *= 0xff51afd7ed558ccdL;
        key ^= key >>> 33;
        key *= 0xc4ceb9fe1a85ec53L;
        key ^= key >>> 33;
        return key;
    }
}

Related

  1. hash(int seed, int val)
  2. hash(int state1, int state2, int numStates1)
  3. hash(int val)
  4. hash(int value)
  5. hash(int x, int y)
  6. hash(long mover, long enemy)
  7. hash(Object a, Object b)
  8. hash(Object key, int limit)
  9. hash(Object o)