public override int NextDoc()
{
if (Doc == NO_MORE_DOCS || ++Doc >= NumBits)
{
return Doc = NO_MORE_DOCS;
}
int i = Doc >> 6;
int subIndex = Doc & 0x3f; // index within the word
long word = bits[i] >> subIndex; // skip all the bits to the right of index
if (word != 0)
{
return Doc = Doc + Number.NumberOfTrailingZeros(word);
}
while (++i < NumWords)
{
word = bits[i];
if (word != 0)
{
return Doc = (i << 6) + Number.NumberOfTrailingZeros(word);
}
}
return Doc = NO_MORE_DOCS;
}