public boolean flipAndGet(int index) {
        assert index >= 0 && index < (wlen << 6);

        int wordNum = index >> 6; // div 64
        int bit = index & 0x3f; // mod 64
        long bitmask = 1L << bit;
        setWord(wordNum, word(wordNum) ^ bitmask);
        return (word(wordNum) & bitmask) != 0;
    }
flips a bit and returns the resulting bit value. The index should be less than the
BitSet size.

@param index the index to flip
@return previous state of the index
indexr-common/src/main/java/io/indexr/util/DirectBitMap.java