getBit()

Returns the value of a particular bit.

Synopsis

int getBit(bit32 aBitVar, int position);

int getBit(bit64 aBitVar, int position);

Parameters

Parameter Description
aBitVar Bit32/Bit64 variable to be examined
position Position of the bit

Return value

The function returns either 0 or 1 or in the event of errors, -1.

Error

In the event of an incorrect argument number

Description

Returns the value of the bit 0 or 1, at a position position in the range from 0 to 31 (bit32) or from 0 to 63 (bit64). The least significant bit is the 0 position.

Example

main()
{
  bit32 b;
  b=13;// 1101
  DebugN(getBit(b,1)); // returns 0
}

Assignment

Functions for bit32/bit64 variables

Availability

CTRL