Manual Reference Pages  - ior (3fortran)

NAME

IOR(3) - [BIT:LOGICAL] Bitwise logical inclusive OR

SYNOPSIS

result = ior(i, j)

         elemental integer(kind=KIND) function ior(i,j)

integer(kind=KIND ,intent(in) :: i integer(kind=KIND ,intent(in) :: j

CHARACTERISTICS

o I, J and the result shall have the same integer type and kind, with the exception that one of I or J may be a BOZ constant.

DESCRIPTION

IOR(3) returns the bit-wise Boolean inclusive-or of I and J.

OPTIONS

o I : one of the pair of values to compare the bits of
o J : one of the pair of values to compare the bits of
If either I or J is a BOZ-literal-constant, it is first converted as if by the intrinsic function INT(3) to type integer with the kind type parameter of the other.

RESULT

The result has the value obtained by combining I and J bit-by-bit according to the following table:

              I   J   IOR (I, J)
              1   1        1
              1   0        1
              0   1        1
              0   0        0

Where if the bit is set in either input value, it is set in the result. Otherwise the result bit is zero.

This is commonly called the "bitwise logical inclusive OR" of the two values.

EXAMPLES

Sample program:

    program demo_ior
    implicit none
    integer :: i, j, k
       i=53       ! i=00110101 binary (lowest order byte)
       j=45       ! j=00101101 binary (lowest order byte)
       k=ior(i,j) ! k=00111101 binary (lowest order byte), k=61 decimal
       write(*,’(i8,1x,b8.8)’)i,i,j,j,k,k
    end program demo_ior

Results:

       > 53 00110101
       > 45 00101101
       > 61 00111101

STANDARD

Fortran 95

SEE ALSO

BTEST(3), IAND(3), IBCLR(3), IBITS(3), IBSET(3), IEOR(3), MVBITS(3), NOT(3)

Fortran intrinsic descriptions (license: MIT) @urbanjost


Nemo Release 3.1 ior (3fortran) November 02, 2024
Generated by manServer 1.08 from 77051384-24a8-4bea-b52b-7458b3907bfd using man macros.