The Regents of the University of California. All rights reserved.
%sccs.include.proprietary.roff%
@(#)bit.3 8.1 (Berkeley) 06/05/93
The bitwise combinatorial functions return the bitwise ``and'' (and), ``or'' (or), or ``exclusive or'' (xor) of two operands. Not returns the bitwise complement of its operand.
Lshift , or rshift with a negative nbits , is a logical left shift with no end around carry. Rshift , or lshift with a negative nbits , is an arithmetic right shift with sign extension. No test is made for a reasonable value of nbits.
These functions may be used to create a variety of general routines, as in the following statement function definitions: integer bitset, bitclr, getbit, word, bitnum bitset( word, bitnum ) = or(word,lshift(1,bitnum))
bitclr( word, bitnum ) = and(word,not(lshift(1,bitnum)))
getbit( word, bitnum ) = and(rshift(word,bitnum),1)