BOOL(3F) BOOL(3F)
bool: iand, kiand, and, iior, ior, or, jior, kior, inot, jnot, knot, not,
iieor, jieor, kieor, ieor, xor, iishft, jishft, kishft, ishft, lshift,
rshift, iishftc, jishftc, kishftc, ishftc, iibits, jibits, kibits, ibits,
iibset, jibset, kibset, ibset, bitest, bjtest, bktest, btest, iibclr,
jibclr, kibclr, ibclr, mvbits - FORTRAN bitwise boolean functions
integer i, k, l, m, n, len
integer*2 ii1, ii2, ii3
integer*8 kk1, kk2, kk3
logical b
logical*2 c
logical*8 cc
i = iand(m, n)
kk3 = kiand(kk1, kk2)
i = and(m, n)
ii3 = iior(ii1, ii2)
kk3 = kior(kk1, kk2)
i = ior(m, n)
i = or(m, n)
i = jior(m, n)
ii3 = inot(ii1)
kk3 = knot(kk1)
i = jnot(m)
i = not(m)
ii3 = iieor(ii1, ii2)
kk3 = kieor(kk1, kk2)
i = jieor(m, n)
i = ieor(m, n)
i = xor(m, n)
ii3 = iishft(ii1, ii2)
kk3 = kishft(kk1, kk2)
i = jishft(m, k)
i = ishft(m, k)
i = lshift(m, k)
i = rshift(m, k)
ii3 = iishftc(ii1, ii2, len)
kk3 = kishftc(kk1, kk2, len)
i = jishftc(m, k, len)
i = ishftc(m, k, len)
ii3 = iibits(ii1, ii2, len)
kk3 = kibits(kk1, kk2, len)
i = jibits(m, k, len)
i = ibits(m, k, len)
Page 1
BOOL(3F) BOOL(3F)
ii3 = iibset(ii1, ii2)
kk3 = kibset(kk1, kk2)
i = jibset(n, k)
i = ibset(n, k)
c = bitest(ii1, ii2)
cc = bktest(kk1, kk2)
b = bjtest(n, k)
b = btest(n, k)
ii3 = iibclr(ii1, ii2)
kk3 = kibclr(kk1, kk2)
i = jibclr(n, k)
i = ibclr(n, k)
call mvbits(m, k, len, n, l)
bool is the general name for the bit field manipulation intrinsic
functions and subroutines from the FORTRAN Military Standard (MIL-STD1753).
and, or and xor return the value of the binary operations on their
arguments. not is a unary operator returning the one's complement of its
argument. ior, iand, not, ieor - return the same results as and, or,
not, and xor.
lshift and rshift return the value of the first argument shifted left or
right, respectively, the number of times specified by the second
(integer) argument. lshift and rshift are implemented as logical shifts,
in other words, zeros are shifted in.
ishft, ishftc - m specifies the integer to be shifted. k specifies the
shift count. k > 0 indicates a left shift. k = 0 indicates no shift. k
< 0 indicates a right shift. In ishft, zeros are shifted in. In ishftc,
the rightmost len bits are shifted circularly k bits. If k is greater
than the machine word-size, ishftc will not shift.
iand, ior, not, ieor, and ishft accept either integer*2 or integer*4
arguments and the result is the same type. When one of these intrinsics
is specified as an argument in a subroutine call or function reference,
the compiler supplies either an integer*2 or integer*4 function depending
on the -i2 command line option.
Bit fields are numbered from right to left and the rightmost bit position
is zero. The length of the len field must be greater than zero.
ibits - extract a subfield of len bits from m starting with bit position
k and extending left for len bits. The result field is right justified
and the remaining bits are set to zero.
Page 2
BOOL(3F) BOOL(3F)
btest - The kth bit of argument n is tested. The value of the function
is .TRUE. if the bit is a 1 and .FALSE. if the bit is 0.
ibset - the result is the value of n with the kth bit set to 1.
ibclr - the result is the value of n with the kth bit set to 0.
mvbits - len bits are moved beginning at position k of argument m to
position l of argument n.
The rightmost bit is bit position 0.
If the user specifies a shift count larger than or equal to the machine
word size the result of the shift operation is undefined. Similarly, bit
operations which involve bit positions less than 0 or greater than the
machine word size will have indeterminate results.
Since intrinsic functions promote their arguments to the largest type in
the argument list, unexpected sign extensions may occur. For example:
integer *1 m,k,i,j
m=-1
k=1
i=rshift(m,k)
j=rshift(m,1)
The value of i will be 127, a 0 is shifted into bit position 7 of the
byte. However the value of j will be -1, both arguments are converted to
integer, sign extending m, a shift is performed, shifting a 0 into bit
position 31. The result is truncated to 8 bits and stored in j.
Page 3
OR(3M) Last changed: 1-6-98
OR - Computes logical sum
OR ([I=]i,[J=]j)
UNICOS, UNICOS/mk, and IRIX systems
Compiler extension to Fortran 90
OR is an elemental function for the CF90 compiler.
arg, i, or j can be of type Boolean, integer, real, logical, or Cray
pointer.
This is an outmoded routine for the CF90 compiler. Refer to the
Fortran Language Reference Manual, Volume 3, publication SR-3905, for
information about outmoded features and their preferred standard
alternatives.
The name of this intrinsic cannot be passed as an argument.
Unexpected results can occur when Boolean functions are declared
external and then used with logical arguments. The external Boolean
functions always treat their arguments as type Boolean and return a
Boolean result on UNICOS and UNICOS/mk systems. On IRIX systems, they
return an integer result.
When given two arguments of type logical, OR computes a logical sum
and returns a logical result.
When given two arguments of type integer, real, Boolean, or pointer,
OR computes a bit-wise logical sum and returns a Boolean result. No
type conversion occurs.
The following tables show both the logical sum and bit-wise logical
sum:
-----------------------------------------------------------------
Logical Logical (Logical Variable 1) OR
Variable 1 Variable 2 (Logical Variable 2)
-----------------------------------------------------------------
T T T
T F T
F T T
F F F
-----------------------------------------------------------------
--------------------------------------------------------------
Bit of Bit of (Bit of Variable 1) OR
Variable 1 Variable 2 (Bit of Variable 2)
--------------------------------------------------------------
1 1 1
1 0 1
0 1 1
0 0 0
--------------------------------------------------------------
The following section of Fortran code shows the OR function used with
two arguments of type logical:
LOGICAL L1, L2, L3
...
L3 = OR(L1,L2)
The following section of Fortran code shows the OR function used with
two arguments of type integer. The bit patterns of the arguments and
result are also shown. For clarity, only the rightmost 8 bits are
shown.
INTEGER I1, I2, I3
I1 = 12
I2 = 10
...
I3 = OR(I1,I2)
------------------------------- -------------------------------
| 0 | | | | | | | | | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 |
------------------------------- -------------------------------
I1 I2
-------------------------------
| 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 |
-------------------------------
I3
Intrinsic Procedures Reference Manual, publication SR-2138, for the
printed version of this man page.
OR(3M) Last changed: 1-6-98
OR - Computes logical sum
OR ([I=]i,[J=]j)
UNICOS, UNICOS/mk, and IRIX systems
Compiler extension to Fortran 90
OR is an elemental function for the CF90 compiler.
arg, i, or j can be of type Boolean, integer, real, logical, or Cray
pointer.
This is an outmoded routine for the CF90 compiler. Refer to the
Fortran Language Reference Manual, Volume 3, publication SR-3905, for
information about outmoded features and their preferred standard
alternatives.
The name of this intrinsic cannot be passed as an argument.
Unexpected results can occur when Boolean functions are declared
external and then used with logical arguments. The external Boolean
functions always treat their arguments as type Boolean and return a
Boolean result on UNICOS and UNICOS/mk systems. On IRIX systems, they
return an integer result.
When given two arguments of type logical, OR computes a logical sum
and returns a logical result.
When given two arguments of type integer, real, Boolean, or pointer,
OR computes a bit-wise logical sum and returns a Boolean result. No
type conversion occurs.
The following tables show both the logical sum and bit-wise logical
sum:
-----------------------------------------------------------------
Logical Logical (Logical Variable 1) OR
Variable 1 Variable 2 (Logical Variable 2)
-----------------------------------------------------------------
T T T
T F T
F T T
F F F
-----------------------------------------------------------------
--------------------------------------------------------------
Bit of Bit of (Bit of Variable 1) OR
Variable 1 Variable 2 (Bit of Variable 2)
--------------------------------------------------------------
1 1 1
1 0 1
0 1 1
0 0 0
--------------------------------------------------------------
The following section of Fortran code shows the OR function used with
two arguments of type logical:
LOGICAL L1, L2, L3
...
L3 = OR(L1,L2)
The following section of Fortran code shows the OR function used with
two arguments of type integer. The bit patterns of the arguments and
result are also shown. For clarity, only the rightmost 8 bits are
shown.
INTEGER I1, I2, I3
I1 = 12
I2 = 10
...
I3 = OR(I1,I2)
------------------------------- -------------------------------
| 0 | | | | | | | | | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 |
------------------------------- -------------------------------
I1 I2
-------------------------------
| 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 |
-------------------------------
I3
Intrinsic Procedures Reference Manual, publication SR-2138, for the
printed version of this man page.
[ Back ]
|