Bitwise 'OR' over two 2D integer array of kind 4
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=4), | intent(in), | dimension(:, :) | :: | a | ||
integer(kind=4), | intent(in), | dimension(:, :) | :: | b |
function int4_2D_or_int4_2D(a, b) result(r)
!< Bitwise 'OR' over two 2D integer array of kind 4
implicit none
integer(kind=4), dimension(:, :), intent(in) :: a
integer(kind=4), dimension(:, :), intent(in) :: b
integer(kind=4), dimension(1:2) :: na, nb
integer(kind=4), dimension(:, :), allocatable :: r
na = shape(a)
nb = shape(b)
if ((na(1) /= nb(1)) .or. (na(2) /= nb(2))) then
print *, "Error: Sizes of arrays being 'or'ed should be the same."
stop
end if
allocate(r(1:na(1), 1:na(2)))
r = ior(a, b)
end function int4_2D_or_int4_2D