Fortran Wiki merge_bits

Description

merge_bits(i, j, mask) merges the bits of i and j as determined by the mask. The $k$-th bit of the result is equal to the $k$-th bit of i if the $k$-th bit of mask is 1; it is equal to the $k$-th bit of j otherwise.

Standard

Fortran 2008 and later

Class

Elemental function

Syntax

result = merge_bits(i, j, mask)

Arguments

• i - Shall be of type integer.
• j - Shall be of type integer and of the same kind as i.
• mask - Shall be of type integer and of the same kind as i.

Return value

The result is of the same type and kind as i.

category: intrinsics