I want to take in a byte [] and convert it to a bool []. I have found a code that places the bool in a bool queue, but I don't posses the necessary skill/knowledge to go from a method that gives me a bool queue to a method that gives me a bool array.
Any help is appreciated!
public void TmsTdiEnqueue(int bitCount, byte[] byteArray)
{
// New TAP bit queues with allocated number of bits
boolQueue = new Queue<bool>(bitCount);
// Fill bool queue
int byteIndex = 0;
int bitMask = 0x01;
for (int i = 0; i < bitCount; i++)
{
boolQueue.Enqueue((tmsBytes[byteIndex] & bitMask) != 0);
IncrementBitPointer(ref byteIndex, ref bitMask);
}
}
private void IncrementBitPointer(ref int byteIndex, ref int bitMask)
{
byteIndex += (bitMask == 0x80) ? 1 : 0;
bitMask = (bitMask == 0x80) ? 0x01 : bitMask << 1;
}
boolarray? When should be an element of ittrueand when should it befalse?