// Path: src/main/java/com/googlecode/javaewah/EWAHCompressedBitmap.java
// public static final int WORD_IN_BITS = 64;


import static com.googlecode.javaewah.EWAHCompressedBitmap.WORD_IN_BITS;
    }

    @Override
    public int next() {
        final int answer;
        if (literalHasNext()) {
            final long t = this.word & -this.word;
            answer = this.literalPosition - Long.bitCount(t - 1);
            this.word ^= t;
        } else {
            answer = this.position--;
        }
        this.hasNext = this.moveToPreviousRLW();
        return answer;
    }

    private boolean moveToPreviousRLW() {
        while (!literalHasNext() && !runningHasNext()) {
            if (!this.ewahIter.hasPrevious()) {
                return false;
            }
            setRLW(this.ewahIter.previous());
        }
        return true;
    }

    private void setRLW(RunningLengthWord rlw) {
        this.wordLength = rlw.getNumberOfLiteralWords();
        this.wordPosition = this.ewahIter.position();
        this.position = this.runningLength;
// Path: src/main/java/com/googlecode/javaewah/EWAHCompressedBitmap.java
// public static final int WORD_IN_BITS = 64;


// Path: src/main/java/com/googlecode/javaewah/ReverseIntIterator.java
import static com.googlecode.javaewah.EWAHCompressedBitmap.WORD_IN_BITS;

    }

    @Override
    public int next() {
        final int answer;
        if (literalHasNext()) {
            final long t = this.word & -this.word;
            answer = this.literalPosition - Long.bitCount(t - 1);
            this.word ^= t;
        } else {
            answer = this.position--;
        }
        this.hasNext = this.moveToPreviousRLW();
        return answer;
    }

    private boolean moveToPreviousRLW() {
        while (!literalHasNext() && !runningHasNext()) {
            if (!this.ewahIter.hasPrevious()) {
                return false;
            }
            setRLW(this.ewahIter.previous());
        }
        return true;
    }

    private void setRLW(RunningLengthWord rlw) {
        this.wordLength = rlw.getNumberOfLiteralWords();
        this.wordPosition = this.ewahIter.position();
        this.position = this.runningLength;
        this.runningLength -= WORD_IN_BITS * (rlw.getRunningLength() + this.wordLength);