btest(i,pos)
returns logical .true.
if the bit at pos
in i
is set.
Fortran 95 and later
result = btest(i, pos)
i
- The type shall be integer
.pos
- The type shall be integer
. A value of zero refers to the least significant bit.The return value is of type logical
program test_btest
integer :: i = 32768 + 1024 + 64
integer :: pos
logical :: bool
do pos=0,16
bool = btest(i, pos)
print *, pos, bool
end do
end program test_btest
ibclr, ibits, ibset, iand, ior, ieor, mvbits