private int insertKey(long key) {
        int hash, index;

        hash = ((int) (key ^ (key >>> 32))) & 0x7fffffff;
        index = hash % set.length;
        boolean state = set[index] != 0;

        consumeFreeSlot = false;

        if (!state) {
            consumeFreeSlot = true;
//            insertKeyAt(index, key);
            set[index] = key;  // insert value

            return index;      // empty, all done
        }

        if (set[index] == key) {
            return -index - 1;   // already stored
        }

        // already FULL or REMOVED, must probe
//        return insertKeyRehash(key, index, hash);
        {
            // compute the double hash
            final int length = set.length;
            int probe = 1 + (hash % (length - 2));
            final int loopIndex = index;

            /**
             * Look until FREE slot or we start to loop
             */
            do {
                index -= probe;
                if (index < 0) {
                    index += length;
                }

                state = set[index] != 0;

                // A FREE slot stops the search
                if (!state) {
                    consumeFreeSlot = true;
//                    insertKeyAt(index, val);
                    set[index] = key;  // insert value
                    return index;
                }

                if (set[index] == key) {
                    return -index - 1;
                }

                // Detect loop
            } while (index != loopIndex);

            // Can a resizing strategy be found that resizes the set?
            throw new IllegalStateException("No free or removed slots available. Key set full?!!");
        }
    }
Locates the index at which <tt>val</tt> can be inserted.  if
there is already a value equal()ing <tt>val</tt> in the set,
returns that value as a negative integer.

@param key an <code>long</code> value
@return an <code>int</code> value
core/src/main/java/com/alibaba/fastjson2/internal/trove/map/hash/TLongIntHashMap.java