Method CountBits
CountBits(int, int)
Returns the number of bits in a range that are 1.
Declaration
public int CountBits(int pos, int numBits = 1)
Parameters
Type | Name | Description |
---|---|---|
int | pos | Index of the bit at which to start searching. |
int | numBits | Number of bits to test. Defaults to 1. |
Returns
Type | Description |
---|---|
int | The number of bits in a range of bits that are 1. |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown if |