ScanBits

Scans a bit array to find the first bit set

Local Servers:nonblocking
Remote Servers:N/A
Classification:3.x, 4.x, 5.x, 6.x
Service:Bit Array

Syntax

  #include <nwbitops.h>  
   
  LONG ScanBits  (  
     void   *bitArray,   
     LONG    startingBitNumber,   
     LONG    totalBitCount); 
  

Parameters

bitArray
(IN) Points to the bit array.
startingBitNumber
(IN) Specifies the index number of the bit to start searching on.
totalBitCount
(IN) Specifies the size of the bit array.

Return Values

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.

Remarks

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

See Also

ScanClearedBits

Example

  #include <nwbitops.h>  
  LONG    bitNumber;  
  void   *bitArray;  
  LONG    startingBitNumber;  
  LONG    totalBitCount;  
  bitNumber = ScanBits (bitArray, startingBitNumber, totalBitCount);