Titan



int2bit


This function converts a single integer value to a single bitstring value. The resulting string is length bits long.

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. If the conversion yields a value with fewer bits than specified in the length parameter, then the bitstring shall be padded on the left with zeros.


Related keyword:


int2bit(in integer value, in integer length) return bitstring


Example 1:

const bitstring c_whole := int2bit (112,8);

The constant called c_whole will contain the string 01110000 because the converted integer number (112 -> 1110000) must be coded on 8 bits and therefore padded with a leading zero.