public Int32 PreviousSetBit(Int32 fromIndex) {
if (fromIndex < 0) {
if (fromIndex == -1) {
return -1;
}
throw new IndexOutOfRangeException("fromIndex cannot be less than zero.");
}
this.CheckInvariants();
Int32 offset = WordIndex(fromIndex);
if (offset >= this._wordsInUse) {
return this.Length - 1;
}
Int32 result = -1;
long w = this._bits[offset] & (LONG_MASK >> -(fromIndex + 1));
while (true) {
if (w != 0) {
result = (offset + 1) * BITS_PER_WORD - 1 - NumberOfTrailingZeros(w);
break;
}
if (offset-- == 0) {
break;
}
w = this._bits[offset];
}
return result;
}