Developer Guide and Reference

ID 767251
Date 10/31/2024
Public
Document Table of Contents

BIC, BIS

Portability Subroutines: Perform a bit-level set and clear for integers.

Module

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.

Example

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 

See Also