.\" Copyright (c) 1983 Regents of the University of California.
.\" All rights reserved. The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\" @(#)bit.3f 6.4 (Berkeley) 4/30/86
.TH BIT 3F "April 30, 1986"
bit \- and, or, xor, not, rshift, lshift bitwise functions
.B (intrinsic) function and (word1, word2)
.B (intrinsic) function or (word1, word2)
.B (intrinsic) function xor (word1, word2)
.B (intrinsic) function not (word)
.B (intrinsic) function rshift (word, nbits)
.B (intrinsic) function lshift (word, nbits)
These bitwise functions are built into the compiler and return
the data type of their argument(s).
The bitwise combinatorial functions return the
bitwise ``and'' (\fBand\fR), ``or'' (\fBor\fR), or ``exclusive or'' (\fBxor\fR)
returns the bitwise complement of its operand.
is a logical left shift with no end around carry.
is an arithmetic right shift with sign extension.
No test is made for a reasonable value of
These functions may be used to create a variety of general routines, as in
the following statement function definitions:
.B integer bitset, bitclr, getbit, word, bitnum
.B bitset( word, bitnum ) = or(word,lshift(1,bitnum))
.B bitclr( word, bitnum ) = and(word,not(lshift(1,bitnum)))
.B getbit( word, bitnum ) = and(rshift(word,bitnum),1)
These functions are generated in-line by the f77 compiler.