BIT_SIZE(I)

Purpose

Returns the number of bits in an integer type. Because only the type of the argument is examined, the argument need not be defined.

Class

Inquiry function

Argument type and attributes

I
An INTENT(IN) INTEGER

Result type and attributes

Scalar integer with the same kind type parameter as I.

Result value

The result is the number of bits in the integer data type of the argument:

IBM extension begins
    type                   bits
-----------                ------
 integer(1)                    8
 integer(2)                   16
 integer(4)                   32
 integer(8)                   64
IBM extension ends

The bits are numbered from 0 to BIT_SIZE(I)-1, from right to left.

Examples

BIT_SIZE (1_4) has the value 32, because the integer type with kind 4 (that is, a four-byte integer) contains 32 bits.