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.

merge_bits(i, j, mask)

i

j

mask

Fortran 2008 and later

Elemental function

result = merge_bits(i, j, mask)

integer

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