int[] (int segmentHashSuffix, byte segmentHashSuffixDepth, byte globalHashSuffixDepth) { assert (segmentHashSuffix & ~suffixMask(segmentHashSuffixDepth)) == 0; assert globalHashSuffixDepth >= segmentHashSuffixDepth : "globalDepth(=" + globalHashSuffixDepth + ") must be >= segmentDepth(=" + segmentHashSuffixDepth + ")"; //If a segment has segmentHashSuffix, when all segmentSlotIndexes with such bit-suffix should point to // it (btw, this is how keys with segment.hashSuffix end up in that segment). // So we need to generate all indexes in [0..2^globalHashSuffixDepth) with [segment.hashSuffix]: we iterate // through all possible (globalDepth-segmentDepth) 'free' prefix bits, while keeping [segmentHashSuffixDepth] // tail bits =[segmentHashSuffix] int indexesCount = 1 << (globalHashSuffixDepth - segmentHashSuffixDepth); int[] slotIndexes = new int[indexesCount]; for (int i = 0; i < indexesCount; i++) { int prefix = i << segmentHashSuffixDepth; slotIndexes[i] = prefix | segmentHashSuffix; } return slotIndexes; }