-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbfnew.3.in
41 lines (40 loc) · 2.03 KB
/
bfnew.3.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
.TH bfnew 3 "%RELEASE_DATE%" "bitfield %VERSION%" "Bit array manipulation library"
.SH NAME
bfnew, bfnew_quick, bfnew_ones, bfdel \- create and delete bit arrays.
.SH SYNOPSIS
.nf
.B "#include <bitfield.h>
.sp
.BI "struct bitfield *bfnew(const unsigned int "size ");
.BI "struct bitfield *bfnew_quick(const unsigned int "size ");
.BI "struct bitfield *bfnew_ones(const unsigned int "size ");
.BI "void bfdel(struct bitfield *"instance ");
.fi
.SH DESCRIPTION
A bit array is represented by a "struct bitfield". It has two elements: an array of unsigned long integers \fIfield\fR and an unsigned integer \fIsize\fR.
.sp
The \fBbfnew()\fR function initializes a bitfield of specified \fIsize\fR (i.e. long enough to host a series of bits of length equal to \fIsize\fR) and returns a pointer to it or NULL on failure. This pointer can later be successfully passed to \fBbfdel()\fR. The bitfield is guaranteed to be empty (i.e. contain only zeroes).
.sp
The \fBbfnew_quick()\fR function does the same thing as \fBbfnew()\fR, except that it does not clear the bits.
.sp
The \fBbfnew_quick()\fR function does the same thing as \fBbfnew()\fR, except that it sets the bits to true (i.e. it contains only ones).
.sp
The \fBbfdel()\fR function frees the memory space pointed to by \fIinstance\fR, which must have been returned by a previous call to \fBbfnew()\fR or another similar function.
.SH EXAMPLES
The following code
.sp
struct bitfield * mybitfield = bfnew(80);
.sp
will create a bitfield called \fImybitfield\fR with \fIsize\fR equal to 3 and a \fIfield\fR, long enough to host 80 bits. The number of longs in \fIfield\fR depends on \fIsize\fR and machine architecture. On machines with 32-bit longs, that will be 3 longs.
.sp
The following code
.sp
bfdel(mybitfield);
.sp
will delete the memory taken by a bitfield called \fImybitfield\fR, effectively deleting the bitfield and making it unavailable for subsequent calls.
.sp
.SH "SEE ALSO"
For the full list of bitfield functions and their descriptions, see manual page for
.BR bitfield (3).
.SH AUTHOR
Vitalie CIUBOTARU