BSD 4_3_Reno release
[unix-history] / usr / src / share / man / man3f / bit.3
index 4d983e9..d15fdcd 100644 (file)
@@ -2,9 +2,9 @@
 .\" All rights reserved.  The Berkeley software License Agreement
 .\" specifies the terms and conditions for redistribution.
 .\"
 .\" All rights reserved.  The Berkeley software License Agreement
 .\" specifies the terms and conditions for redistribution.
 .\"
-.\"    @(#)bit.3       5.1 (Berkeley) %G%
+.\"    @(#)bit.3f      6.4 (Berkeley) 4/30/86
 .\"
 .\"
-.TH BIT 3F "13 June 1983"
+.TH BIT 3F "April 30, 1986"
 .UC 5
 .SH NAME
 bit \- and, or, xor, not, rshift, lshift bitwise functions
 .UC 5
 .SH NAME
 bit \- and, or, xor, not, rshift, lshift bitwise functions
@@ -23,12 +23,11 @@ bit \- and, or, xor, not, rshift, lshift bitwise functions
 .SH DESCRIPTION
 These bitwise functions are built into the compiler and return
 the data type of their argument(s).
 .SH DESCRIPTION
 These bitwise functions are built into the compiler and return
 the data type of their argument(s).
-It is recommended that their arguments be
+Their arguments must be
 .B integer
 .B integer
-values;
-inappropriate manipulation of
-.B real
-objects may cause unexpected results.
+or
+.B logical
+values.
 .PP
 The bitwise combinatorial functions return the
 bitwise ``and'' (\fBand\fR), ``or'' (\fBor\fR), or ``exclusive or'' (\fBxor\fR)
 .PP
 The bitwise combinatorial functions return the
 bitwise ``and'' (\fBand\fR), ``or'' (\fBor\fR), or ``exclusive or'' (\fBxor\fR)
@@ -47,8 +46,19 @@ or
 .I lshift
 with a negative
 .IR nbits ,
 .I lshift
 with a negative
 .IR nbits ,
-is an arithmatic right shift with sign extension.
+is an arithmetic right shift with sign extension.
 No test is made for a reasonable value of
 .I nbits.
 No test is made for a reasonable value of
 .I nbits.
+.PP
+These functions may be used to create a variety of general routines, as in
+the following statement function definitions:
+.sp 1
+.B     integer bitset, bitclr, getbit, word, bitnum
+.sp 1
+.B     bitset( word, bitnum ) = or(word,lshift(1,bitnum))
+.br
+.B     bitclr( word, bitnum ) = and(word,not(lshift(1,bitnum)))
+.br
+.B     getbit( word, bitnum ) = and(rshift(word,bitnum),1)
 .SH FILES
 These functions are generated in-line by the f77 compiler.
 .SH FILES
 These functions are generated in-line by the f77 compiler.