Fortran Library Reference

Usage: and, or, xor, not, rshift, lshift

For the intrinsic functions:

x = and( word1, word2 )

x = or( word1, word2 )

x = xor( word1, word2 )

x = not( word )

x = rshift( word, nbits )

x = lshift( word, nbits )

word, word1, word2, nbits are integer input arguments. These are intrinsic functions expanded inline by the compiler. The data type returned is that of the first argument.

No test is made for a reasonable value of nbits.

Example: and, or, xor, not:


demo% cat tandornot.f
    print 1, and(7,4), or(7,4), xor(7,4), not(4)
 1    format(4x 'and(7,4)', 5x 'or(7,4)', 4x 'xor(7,4)',
&          6x 'not(4)'/4o12.11)
    end
demo% f77 -silent tandornot.f
demo% a.out
    and(7,4)     or(7,4)    xor(7,4)      not(4)
 00000000004 00000000007 00000000003 37777777773
demo%

Example: lshift, rshift:


    integer*4 lshift, rshift
    print 1, lshift(7,1), rshift(4,1)
 1    format(1x 'lshift(7,1)', 1x 'rshift(4,1)'/2o12.11)
    end
demo% f77 -silent tlrshift.f
demo% a.out
 lshift(7,1) rshift(4,1)
 00000000016 00000000002
demo%