ScanClearedBits
Scans a bit array to find the first bit that has been cleared
#include <nwbitops.h> LONG ScanClearedBits ( void *bitArray, LONG startingBitNumber, LONG totalBitCount);
This function returns a bit index (relative to the beginning of the array) to the first bit cleared, or a value of -1 if no bit is cleared.
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-2 Scanning a Bit Array
#include <nwbitops.h> LONG bitNumber; void *bitArray; LONG startingBitNumber; LONG totalBitCount; bitNumber = ScanClearedBits (bitArray, startingBitNumber, totalBitCount);