For the subroutines and functions
call bic( bitnum, word ) |
call bis( bitnum, word ) |
call setbit( bitnum, word, state ) |
LOGICAL bit x = bit( bitnum, word ) |
bitnum, state, and word are INTEGER*4 input arguments. Function bit() returns a logical value.
Bits are numbered so that bit 0 is the least significant bit, and bit 31 is the most significant.
bic, bis, and setbit are external subroutines. bit is an external function.
Example 3: bic, bis, setbit, bit:
integer*4 bitnum/2/, state/0/, word/7/ logical bit print 1, word 1 format(13x ’word’, o12.11) call bic( bitnum, word ) print 2, word 2 format(’after bic(2,word)’, o12.11) call bis( bitnum, word ) print 3, word 3 format(’after bis(2,word)’, o12.11) call setbit( bitnum, word, state ) print 4, word 4 format(’after setbit(2,word,0)’, o12.11) print 5, bit(bitnum, word) 5 format(’bit(2,word)’, L ) end <output> word 00000000007 after bic(2,word) 00000000003 after bis(2,word) 00000000007 after setbit(2,word,0) 00000000003 bit(2,word) F |