Exemple #1
0
INLINE void Write(BitArray  const &in) {
    for (UInt32 i = 0; i < in.Length(); ++i) {
        if (i > 0 && i % 8 == 0)
            WriteChar(' ');
        WriteChar(in[i] ? '1' : '0');
    }
}
Exemple #2
0
//Overload of the non-equivalency operator
bool operator!=(const BitArray& a, const BitArray& b)
{
	bool notEqual = false;
    if (a.Length() == b.Length())
	{
		for (int i = 0; i < a.Length()/CHAR_SIZE; i++)
		{
			if (!(a.barray[i] == b.barray[i]))
				notEqual = true;
		}
	}
	else 
		notEqual = true;

	return notEqual;
}
Exemple #3
0
//Overload of the equivalency operator
bool operator==(const BitArray& a, const BitArray& b)
{
	bool equal = true;
    if (a.Length() == b.Length())
	{
		for (int i = 0; i < a.Length()/CHAR_SIZE; i++)
		{
			if (!(a.barray[i] == b.barray[i]))
				equal = false;
		}
	}
	else 
	{
		equal = false;
	}
	return equal;
}
Exemple #4
0
//Overloaded Condtructor for equals operator
BitArray::BitArray(const BitArray& a)
{
	arraySize = a.Length();

	barray = new unsigned char[arraySize];

	for (int i = 0; i<arraySize; i++)
		barray[i] = a.barray[i];
}