提交 05719a66 authored 作者: Thomas Mueller's avatar Thomas Mueller

A minimal perfect hash function tool: use universal hashing callback (with sample implementations)

上级 74462788
...@@ -570,7 +570,7 @@ public class MinimalPerfectHash<K> { ...@@ -570,7 +570,7 @@ public class MinimalPerfectHash<K> {
public static int getFastHash(String o, int x) { public static int getFastHash(String o, int x) {
int result = o.length(); int result = o.length();
for (int i = 0; i < o.length(); i++) { for (int i = 0; i < o.length(); i++) {
x = 31 + ((x >>> 16) ^ x) * 0x45d9f3b; x = 31 + x * 0x9f3b;
result += x * (1 + o.charAt(i)); result += x * (1 + o.charAt(i));
} }
return result; return result;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论