ln3 Method - GetBit
Description
Get the value of a single bit of a large number.
Signature
short GetBit( size_t bit ) const
Parameters
Name
Type
Description
bit
size_t
The bit to get. Bit numbers are zero relative, beginning with the least significant bit of the large number.
Returns
( short ) 1 if the bit is set, and 0 if it is not.
Example
Use the
GetBit
method to determine if the value in the variable
X
is odd. If it is, print the string
X is odd
:
ln X = "129387192873"; if( X.GetBit( 0 ) ) cout << "X is odd" << endl;