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