MASKR(I, KIND) (Fortran 2008)

Purpose

Performs a right-justified mask.

Class

Elemental function

Argument type and attributes

I
An INTENT(IN) INTEGER. Its value must be non-negative, and less than or equal to the number of bits for the kind of the result.
KIND (optional)
An INTENT(IN) INTEGER scalar. The actual argument corresponding to KIND must be a constant expression.Fortran 2003 ends

Result type and attributes

The result is an integer. In the presence of KIND argument, its kind is specified by the value of KIND. Otherwise, its kind is of default integer type.

Result value

The rightmost I bits set to 1 and the other bits set to 0.

Example

MASKR (3) has the result 7.