merge_bits(i, j, mask) merges the bits of i and j as determined by the mask. The -th bit of the result is equal to the -th bit of i if the -th bit of mask is 1; it is equal to the -th bit of j otherwise.
Fortran 2008 and later
result = merge_bits(i, j, mask)
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.The result is of the same type and kind as i.