-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbfand.3.in
72 lines (71 loc) · 2.98 KB
/
bfand.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
.TH bfand 3 "%RELEASE_DATE%" "bitfield %VERSION%" "Bit array manipulation library"
.SH NAME
bfand, bfnot, bfnot_ip, bfor, bfxor \- perform logical operations over bit arrays.
.SH SYNOPSIS
.nf
.B "#include <bitfield.h>
.sp
.BI "struct bitfield *bfand(const struct bitfield *"input1 ", const struct bitfield *"input2 ", ...);
.BI "struct bitfield *bfnot(const struct bitfield *"input ");
.BI "void bfnot_ip(const struct bitfield *"instance ");
.BI "struct bitfield *bfor(const struct bitfield *"input1 ", const struct bitfield *"input2 ", ...);
.BI "struct bitfield *bfxor(const struct bitfield *"input1 ", const struct bitfield *"input2 ", ...);
.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 \fBbfand()\fR function takes pointers to two or more arguments, all of them pointers to bitfields, performs logical AND over each pairs of bits from the first two (and iteratively with each additional argument, if any) and stores the result in a new bitfield. The function returns a pointer to the new bitfield or NULL on failure.
.sp
The following table illustrates inputs and results of logical AND:
.sp
.nf
input1 input2 output
--------------------
0 0 0
0 1 0
1 0 0
1 1 1
.fi
.sp
The \fBbfnot()\fR function takes pointer to a bitfield, \fIinput\fR, reverses all its bits and stores the result in a new bitfield, \fIoutput\fR. The function returns a pointer to the new bitfield or NULL on failure. The following table illustrates input and result of logical NOT:
.sp
.nf
input output
------------
0 1
1 0
.fi
.sp
The \fBbfnot_ip()\fR function is an "in-place" version of the \fBbnot()\fR.
.sp
The \fBbfor()\fR function takes pointers to two or more arguments, all pointers to bitfields, and performs bitwise inclusive OR over pairs of bits from the first two arguments (then iteratively with every additional argument, if any) and stores the result in a new bitfield. The function returns a pointer to the new bitfield or NULL on failure.
.sp
The following table illustrates inputs and results of logical inclusive OR:
.sp
.nf
input1 input2 output
--------------------
0 0 0
0 1 1
1 0 1
1 1 1
.fi
.sp
The \fBbfxor()\fR function takes pointers to two arguments, all pointers to bitfields, and performs bitwise eXclusive OR (XOR) over pairs of bits from the first two arguments (then iteratively with every additional argument, if any) and stores the result in a new bitfield. The function returns a pointer to the new bitfield or NULL on failure.
.sp
The following table illustrates inputs and results of logical eXclusive OR (XOR):
.sp
.nf
input1 input2 output
--------------------
0 0 0
0 1 0
1 0 1
1 1 0
.fi
.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