@Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof DirectBitMap)) return false;

        DirectBitMap a;
        DirectBitMap b = (DirectBitMap) o;

        // make a the larger set.
        if (b.wlen > this.wlen) {
            a = b;
            b = this;
        } else {
            a = this;
        }

        // check for any set bits out of the range of b
        for (int i = a.wlen - 1; i >= b.wlen; i--) {
            if (a.word(i) != 0) return false;
        }

        for (int i = b.wlen - 1; i >= 0; i--) {
            if (a.word(i) != b.word(i)) return false;
        }

        return true;
    }
Lowers {@link #wlen}, the number of words in use, by checking for trailing zero
words.
indexr-common/src/main/java/io/indexr/util/DirectBitMap.java