Nez.Portable/Utils/BitSet.cs
/// <summary>
/// Returns the index of the next false bit, from the specified bit
/// (inclusive).
/// </summary>
/// <param name="from">the start location</param>
/// <returns>the first false bit</returns>
Returns the index of the next false bit, from the specified bit
(inclusive).
Returns the index of the next false bit from the specified bit ( inclusive ) .
public int nextClearBit(int from)
        {
            var offset = from >> 6;
            var mask = 1L << from;
            while (offset < bits.Length)
            {
                long h = bits[offset];
                do
                {
                    if ((h & mask) == 0)
                        return from;
                    mask <<= 1;
                    from++;
                }
                while (mask != 0);
                mask = 1;
                offset++;
            }
            return from;
        }
public int nextClearBit ( int from ) { var offset = from >> 6 ; var mask = 1L << from ; while ( offset < bits . Length ) { long h = bits [ offset ] ; do { if ( ( h & mask ) == 0 ) return from ; mask <<= 1 ; from ++ ; } while ( mask != 0 ) ; mask = 1 ; offset ++ ; } return from ; }
Returns the index of the next false bit, from the specified bit
(inclusive).
Returns the index of the next false bit from the specified bit ( inclusive ) .
the first false bit
the first false bit
from
int
the start location
the start location