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
BTEST(3I) Last changed: 1-6-98
BTEST - Tests a bit of an integer value
BTEST ([I=]i, [POS=]pos)
UNICOS, UNICOS/mk, and IRIX systems
Fortran 90
The BTEST intrinsic function tests a bit of an integer value. It
accepts the following arguments:
i Must be of type integer.
pos Must be of type integer. It must be nonnegative and be less
than BIT_SIZE(i).
BTEST is an elemental function. The name of this intrinsic cannot be
passed as an argument.
The result is of type default logical. The result has the value TRUE
if bit pos of i has the value 1. It has the value FALSE if bit pos of
i has the value 0. The bit model defines the interpretation of an
integer value as a sequence of bits. This model is described in the
MODELS(3I) man page.
Example 1: BTEST(8, 3) has the value TRUE.
Example 2: BTEST(8_SHORT, 3) has the value TRUE.
Example 3: Assume that A has the following value:
| 1 2 |
| 3 4 |
The value of BTEST(A, 2) is as follows:
| false false |
| false true |
The value of BTEST(2, A) is as follows:
| true false |
| false false |
MODELS(3I)
Intrinsic Procedures Reference Manual, publication SR-2138, for the
printed version of this man page.
BTEST(3I) Last changed: 1-6-98
BTEST - Tests a bit of an integer value
BTEST ([I=]i, [POS=]pos)
UNICOS, UNICOS/mk, and IRIX systems
Fortran 90
The BTEST intrinsic function tests a bit of an integer value. It
accepts the following arguments:
i Must be of type integer.
pos Must be of type integer. It must be nonnegative and be less
than BIT_SIZE(i).
BTEST is an elemental function. The name of this intrinsic cannot be
passed as an argument.
The result is of type default logical. The result has the value TRUE
if bit pos of i has the value 1. It has the value FALSE if bit pos of
i has the value 0. The bit model defines the interpretation of an
integer value as a sequence of bits. This model is described in the
MODELS(3I) man page.
Example 1: BTEST(8, 3) has the value TRUE.
Example 2: BTEST(8_SHORT, 3) has the value TRUE.
Example 3: Assume that A has the following value:
| 1 2 |
| 3 4 |
The value of BTEST(A, 2) is as follows:
| false false |
| false true |
The value of BTEST(2, A) is as follows:
| true false |
| false false |
MODELS(3I)
Intrinsic Procedures Reference Manual, publication SR-2138, for the
printed version of this man page.
[ Back ]
|