private void shiftKeys()

in src/main/software/amazon/event/ruler/IntIntMap.java [216:251]


    private void shiftKeys(final int index) {
        int last;
        int pos = index;
        while (true) {
            last = pos;
            do {
                pos = (pos + 1) & mask;
                if (table[pos] == EMPTY_CELL) {
                    table[last] = EMPTY_CELL;
                    return;
                }
                int key = (int) (table[pos] & KEY_MASK);
                int keyStartIndex = getStartIndex(key);
                if (last < pos) { // did we wrap around?
                    /*
                     * (no) if the previous position is after the chain startIndex for key, *or* the
                     * chain startIndex of the key is after the position we're checking, then the
                     * position we're checking now cannot be a part of the current chain
                     */
                    if (last >= keyStartIndex || keyStartIndex > pos) {
                        break;
                    }
                } else {
                    /*
                     * (yes) if the previous position is after the chain startIndex for key, *and*
                     * the chain startIndex of key is after the position we're checking, then the
                     * position we're checking now cannot be a part of the current chain
                     */
                    if (last >= keyStartIndex && keyStartIndex > pos) {
                        break;
                    }
                }
            } while (true);
            table[last] = table[pos];
        }
    }