Intel® Fortran Compiler 16.0 User and Reference Guide
Portability Subroutines: Perform a bit-level set and clear for integers.
USE IFPORT
CALL BIC (bitnum, target)
CALL BIS (bitnum, target)
bitnum |
(Input) INTEGER(4). Bit number to set. Must be in the range 0 (least significant bit) to 31 (most significant bit) if target is INTEGER(4). If target is INTEGER(8), bitnum must be in range 0 to 63. |
target |
(Input) INTEGER(4) or INTEGER(8). Variable whose bit is to be set. |
BIC sets bit bitnum of target to 0; BIS sets bit bitnum to 1.
Consider the following:
USE IFPORT integer(4) bitnum, target_i4 integer(8) target_i8 target_i4 = Z'AAAA' bitnum = 1 call BIC(bitnum, target_i4) target_i8 = Z'FFFFFFFF00000000' bitnum = 40 call BIC(bitnum, target_i8) bitnum = 0 call BIS(bitnum, target_i4) bitnum = 1 call BIS(bitnum, target_i8) print '(" integer*4 result ",Z)', target_i4 print '(" integer*8 result ",Z)', target_i8 end