ScanBits
Scans a bit array to find the first bit set
#include <nwbitops.h> LONG ScanBits ( void *bitArray, LONG startingBitNumber, LONG totalBitCount);
This function returns a bit index (relative to the beginning of the array) to the first bit set, or a value of -1 if no bit is set.
The bitArray parameter specifies the target array, which can begin on a byte boundary. A bit array can be as large as 2 32 - 1 bits in length.
The totalBitCount parameter specified the total number of bits from the beginning of the array to the end of the search area. Therefore, if the search area is from bit index 5 to bit index 11, the startingBitNumber would be 5 and the totalBitCount would be 12 (the bit index +1).
Figure 1-1 Scanning a Bit Array
#include <nwbitops.h> LONG bitNumber; void *bitArray; LONG startingBitNumber; LONG totalBitCount; bitNumber = ScanBits (bitArray, startingBitNumber, totalBitCount);