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
MVBITS(3I) Last changed: 1-6-98
MVBITS - Copies a sequence of bits from one integer data object to
another
CALL MVBITS ([FROM=]from, [FROMPOS=]frompos, [LEN=]len, [TO=]to,
[TOPOS=]topos)
UNICOS, UNICOS/mk, and IRIX systems
Fortran 90
The MVBITS intrinsic subroutine copies a sequence of bits from one
integer data object to another. It accepts the following arguments:
from Must be of type integer. It is an INTENT (IN) argument.
frompos Must be of type integer and nonnegative. It is an INTENT
(IN) argument. frompos + len must be less than or equal to
BIT_SIZE (from). The bit model defines the interpretation
of an integer value as a sequence of bits. For more
information on the bit model see the MODELS(3I) man page.
len Must be of type integer and nonnegative. It is an INTENT
(IN) argument.
to Must be a variable of type integer with the same kind type
parameter value as from and may be the same variable as
from. It is an INTENT (INOUT) argument. to is set by
copying the sequence of bits of length len, starting at
position frompos of from to position topos of to. No other
bits of to are altered. On return, the len bits of to
starting at topos are equal to the value that the len bits
of from starting at frompos had on entry.
topos Must be of type integer and nonnegative. It is an INTENT
(IN) argument. topos + len must be less than or equal to
BIT_SIZE (to).
MVBITS is an elemental subroutine. The name of this intrinsic cannot
be passed as an argument.
If TO has the initial value 6, the value of TO after the statement
CALL MVBITS(7, 2, 2, TO, 0) is 5.
MODELS(3I)
Intrinsic Procedures Reference Manual, publication SR-2138, for the
printed version of this man page.
MVBITS(3I) Last changed: 1-6-98
MVBITS - Copies a sequence of bits from one integer data object to
another
CALL MVBITS ([FROM=]from, [FROMPOS=]frompos, [LEN=]len, [TO=]to,
[TOPOS=]topos)
UNICOS, UNICOS/mk, and IRIX systems
Fortran 90
The MVBITS intrinsic subroutine copies a sequence of bits from one
integer data object to another. It accepts the following arguments:
from Must be of type integer. It is an INTENT (IN) argument.
frompos Must be of type integer and nonnegative. It is an INTENT
(IN) argument. frompos + len must be less than or equal to
BIT_SIZE (from). The bit model defines the interpretation
of an integer value as a sequence of bits. For more
information on the bit model see the MODELS(3I) man page.
len Must be of type integer and nonnegative. It is an INTENT
(IN) argument.
to Must be a variable of type integer with the same kind type
parameter value as from and may be the same variable as
from. It is an INTENT (INOUT) argument. to is set by
copying the sequence of bits of length len, starting at
position frompos of from to position topos of to. No other
bits of to are altered. On return, the len bits of to
starting at topos are equal to the value that the len bits
of from starting at frompos had on entry.
topos Must be of type integer and nonnegative. It is an INTENT
(IN) argument. topos + len must be less than or equal to
BIT_SIZE (to).
MVBITS is an elemental subroutine. The name of this intrinsic cannot
be passed as an argument.
If TO has the initial value 6, the value of TO after the statement
CALL MVBITS(7, 2, 2, TO, 0) is 5.
MODELS(3I)
Intrinsic Procedures Reference Manual, publication SR-2138, for the
printed version of this man page.
[ Back ]
|