Titan



bit2int


This function converts a single bitstring value to a single integer value.

For the purposes of this conversion, a bitstring shall be interpreted as a positive base 2 integer value. The rightmost bit is least significant, the leftmost bit is the most significant. The bits 0 and 1 represent the decimal values 0 and 1 respectively.


Related keyword:


bit2int(bitstring value) return integer


Example 1:

const integer c_samostatny := bit2int('1111111'B);

The constant called c_samostatny will have the integer value 127. The result will be always positive.