LF Fortran 95

IBCLR Function

Description

The IBCLR function sets one or more bits in an integer argument to zero.

Syntax

IBCLR (i, pos)

Arguments

i is an INTENT(IN) scalar or array of type INTEGER.

pos is an INTENT(IN) scalar or array of type INTEGER. The value of pos must be within the range zero to (BIT_SIZE(i)-1).

If i and pos are both arrays, they must have the same shape.

Result

The result is of type default INTEGER. Its value is i with the bit at position pos is set to zero.

If i is an array and pos is scalar, the result is an array with the same shape as i. Each element of the resulting array has the bit at position pos set to zero.

If i is scalar and pos is an array, the result is an array with the same shape as pos. Each element of the resulting array contains the value of i with the bit indicated by the corresponding element of pos set to zero.

If i and pos are both arrays, the result is an array with the same shape as i. Each element of the resulting array contains the value from the corresponding element of i with the bit indicated by the corresponding element of pos set to zero.

Example

integer :: i=-1,p=3,ia(2)=(/-1,7/),pa(2)=(/1,2/) write(*,"(b34)") i ! writes 0 write(*,"(b34)") ibclr(i,p) ! writes 1000 write(*,"(2b34)") ibclr(i,pa) ! writes 10 100 write(*,"(2b34)") ia ! writes 111...111111 write(*,"(2b34)") ibclr(ia,p) ! writes 111...110111 write(*,"(2b34)") ibclr(ia,pa) ! writes 111...111101

See Also

BIT_SIZE Function