提交 4b3c5888 authored 作者: Thomas Mueller's avatar Thomas Mueller

Documentation

上级 a0a73b6d
...@@ -344,10 +344,16 @@ public class MinimalPerfectHash<K> { ...@@ -344,10 +344,16 @@ public class MinimalPerfectHash<K> {
} }
if (size <= MAX_SIZE) { if (size <= MAX_SIZE) {
int maxOffset = MAX_OFFSETS[size]; int maxOffset = MAX_OFFSETS[size];
// get the hash codes - we could stop early
// if we detect that two keys have the same hash
int[] hashes = new int[size]; int[] hashes = new int[size];
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
hashes[i] = hash.hashCode(list.get(i), level, seed); hashes[i] = hash.hashCode(list.get(i), level, seed);
} }
// use the supplemental hash function to find a way
// to make the hash code unique within this group -
// there might be a much faster way than that, by
// checking which bits of the hash code matter most
nextOffset: nextOffset:
for (int offset = 0; offset < maxOffset; offset++) { for (int offset = 0; offset < maxOffset; offset++) {
int bits = 0; int bits = 0;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论