/** * A simple hashing algorithm for a 64-bit value * * @param l0 to hash * @return hash value. */ public static long hash64(long l0) { int l0a = (int) (l0 >> 32); long h0 = l0 * M0 + l0a * M1; return agitate(h0); }
/** * A simple hashing algorithm for a 64-bit value * * @param l0 to hash * @return hash value. */ public static long hash64(long l0) { int l0a = (int) (l0 >> 32); long h0 = l0 * M0 + l0a * M1; return agitate(h0); }
/** * A simple hashing algorithm for a 128-bit value * * @param l0 to hash * @param l1 to hash * @return hash value. */ public static long hash64(long l0, long l1) { int l0a = (int) (l0 >> 32); int l1a = (int) (l1 >> 32); long h0 = (l0 + l1a) * M0; long h1 = (l1 + l0a) * M1; return agitate(h0) ^ agitate(h1); }
/** * A simple hashing algorithm for a 128-bit value * * @param l0 to hash * @param l1 to hash * @return hash value. */ public static long hash64(long l0, long l1) { int l0a = (int) (l0 >> 32); int l1a = (int) (l1 >> 32); long h0 = (l0 + l1a) * M0; long h1 = (l1 + l0a) * M1; return agitate(h0) ^ agitate(h1); }
public static long hash64(@NotNull CharSequence cs) { long hash = 0; for (int i = 0, len = cs.length(); i < len; i++) hash = hash * 841248317 + cs.charAt(i); return agitate(hash); }
public static long hash64(@NotNull CharSequence cs) { long hash = 0; for (int i = 0, len = cs.length(); i < len; i++) hash = hash * 841248317 + cs.charAt(i); return agitate(hash); }
public static long hash64(@NotNull String s) { long hash = 0; if (Jvm.isJava9Plus()) { final byte[] bytes = StringUtils.extractBytes(s); for (int i = 0, len = s.length(); i < len; i++) hash = hash * 841248317 + bytes[i]; } else { final char[] chars = StringUtils.extractChars(s); for (int i = 0, len = s.length(); i < len; i++) hash = hash * 841248317 + chars[i]; } return agitate(hash); }
public static long hash64(@NotNull String s) { long hash = 0; if (Jvm.isJava9Plus()) { final byte[] bytes = StringUtils.extractBytes(s); for (int i = 0, len = s.length(); i < len; i++) hash = hash * 841248317 + bytes[i]; } else { final char[] chars = StringUtils.extractChars(s); for (int i = 0, len = s.length(); i < len; i++) hash = hash * 841248317 + chars[i]; } return agitate(hash); }
public static long hash64(@NotNull StringBuilder s) { long hash = 0; if (Jvm.isJava9Plus()) { final byte[] bytes = StringUtils.extractBytes(s); for (int i = 0, len = s.length(); i < len; i++) hash = hash * 841248317 + bytes[i]; } else { final char[] chars = StringUtils.extractChars(s); for (int i = 0, len = s.length(); i < len; i++) hash = hash * 841248317 + chars[i]; } return agitate(hash); }
public static long hash64(@NotNull StringBuilder s) { long hash = 0; if (Jvm.isJava9Plus()) { final byte[] bytes = StringUtils.extractBytes(s); for (int i = 0, len = s.length(); i < len; i++) hash = hash * 841248317 + bytes[i]; } else { final char[] chars = StringUtils.extractChars(s); for (int i = 0, len = s.length(); i < len; i++) hash = hash * 841248317 + chars[i]; } return agitate(hash); }