These are filled with data.
In this array I need to find the first 0 byte.
So if the array looks like
data[1] = 11111111
data[2] = 11111111
data[3] = 11010101
data[4] = 11010101
data[5] = 11110111
.....
This has to return the 2nd bit of the 3th byte.
The first byte '(data[1]) contains data from 7 to 0.
The second byte (data[2]) data from 15 - 8
So I need to find the 2nd bit in the 3th byte.
And this needs to get converted to "17" because it's the 17th spot in the data array.
What I first did was to loop through the array until an data byte <>255
So this loop stops at data[3].
Then I check bit per bit if it is 1 or 0 through a loop.
Code: Select all
Loop until Zerobit = 0
ZeroBit = (data[3] >> Counter) & 1
counter = counter + 1
End loop
Is there a more lean way of checking an array of bytes for the first 0 value?
What is the easiest method to find the first 0 in this array and return the spot of where it resides?
Thanks