/// <summary> /// Compares this <see cref="BitArrayNeo"/> /// with a <see cref="BitSet"/> to see if they are equal. /// </summary> /// <param name="other">The bit set.</param> /// <returns>Whether they are equal.</returns> /// <remarks>The <see cref="BitCapacity"/> of this /// bit array is not taken into account.</remarks> public bool Equals(BitSet other) { if (_data.Length == 0) { return(other.IsEmpty); } ReadOnlySpan <ulong> extra = _data.AsSpan(1); extra = BitAlgorithms.TrimTrailingZeroes(extra); return(_data[0] == other.Data && extra.SequenceEqual(other.Extra)); }
/// <summary> /// Converts this <see cref="BitArrayNeo"/> to a <see cref="BitSet"/>. /// </summary> public BitSet ToBitSet() { if (_data.Length == 0) { return(BitSet.Empty); } ReadOnlySpan <ulong> extra = _data.AsSpan(1); extra = BitAlgorithms.TrimTrailingZeroes(extra); return(new BitSet(_data[0], extra.ToArray())); }