efficiently compare two BitArrays of the same length
- by BobTurbo
How would I do this? I am trying to count when both arrays have the same value of TRUE/1 at the same index. As you can see, my code has multiple bitarrays and is looping through each one and comparing them with a comparisonArray with another loop. It doesn't seem to be very efficient and I need it to be.
foreach (bitArrayTuple in bitarryList) {
for (int i = 0; i < arrayLength; i++)
if (bArrayTuple.Item2[i] && comparisonArray[i])
bitArrayTuple.Item1++;
}
where Item1 is the count and Item2 is a bitarray.