/// <summary>
/// Check if two arrays of bits are equals
/// Returns true if every bit of this first array is equal to the corresponding bit of the second, false otherwise
/// </summary>
public static bool Equals(BitArray a, BitArray b)
{
if (a.Length != b.Length) return false;
var enumA = a.GetEnumerator();
var enumB = b.GetEnumerator();
while (enumA.MoveNext() && enumB.MoveNext())
{
if ((bool)enumA.Current != (bool)enumB.Current) return false;
}
return true;
}