src/AnvilPacker/Util/Collections/BitSet.cs
/// <summary> Checks whether all bits in the specified range are equal to <paramref name="value"/>. </summary>
/// <param name="count">If negative, <see cref="Length"/> is used</param>
Checks whether all bits in the specified range are equal to .
Checks whether all bits in the specified range are equal to .
public bool All(bool value, int offset = 0, int count = -1)
        {
            int end = offset + (count >= 0 ? count : _len);
            int startWord = offset >> 6;
            int lastWord = end >> 6;
            if (end >= Length) return false;
            ulong firstWordMask = WORD_ALL << offset;
            ulong lastWordMask = WORD_ALL >> -end;
            ulong flipMask = Broadcast(value);
            if (startWord == lastWord) {
                ulong mask = firstWordMask & lastWordMask;
                return (_vals[startWord] & mask) == (flipMask & mask);
            } else {
                for (int i = startWord + 1; i < lastWord; i++) {
                    if (_vals[i] != flipMask) {
                        return false;
                    }
                }
                return (_vals[startWord] & firstWordMask) == (flipMask & firstWordMask) &&
                       (_vals[lastWord ] &  lastWordMask) == (flipMask & lastWordMask);
            }
        }
public bool All ( bool value , int offset = 0 , int count = - 1 ) { int end = offset + ( count >= 0 ? count : _len ) ; int startWord = offset >> 6 ; int lastWord = end >> 6 ; if ( end >= Length ) return false ; ulong firstWordMask = WORD_ALL << offset ; ulong lastWordMask = WORD_ALL >> - end ; ulong flipMask = Broadcast ( value ) ; if ( startWord == lastWord ) { ulong mask = firstWordMask & lastWordMask ; return ( _vals [ startWord ] & mask ) == ( flipMask & mask ) ; } else { for ( int i = startWord + 1 ; i < lastWord ; i ++ ) { if ( _vals [ i ] != flipMask ) { return false ; } } return ( _vals [ startWord ] & firstWordMask ) == ( flipMask & firstWordMask ) && ( _vals [ lastWord ] & lastWordMask ) == ( flipMask & lastWordMask ) ; } }
Checks whether all bits in the specified range are equal to .
Checks whether all bits in the specified range are equal to .
value
bool
offset
int
count
int
If negative,  is used
If negative is used