bits.c File Reference
Handle operations on arrays of bits.
More...
#include "common.h"
#include "bits.h"
Go to the source code of this file.
|
Functions |
Bits * | bitAlloc (int bitCount) |
| Allocate bits.
|
void | bitAnd (Bits *a, Bits *b, int bitCount) |
| And two bitmaps.
|
void | bitClear (Bits *b, int bitCount) |
| Clear many bits (possibly up to 7 beyond bitCount).
|
void | bitClearOne (Bits *b, int bitIx) |
| Clear a single bit.
|
void | bitClearRange (Bits *b, int startIx, int bitCount) |
| Clear a range of bits.
|
Bits * | bitClone (Bits *orig, int bitCount) |
| Clone bits.
|
int | bitCountRange (Bits *b, int startIx, int bitCount) |
| Count number of bits set in range.
|
int | bitFindClear (Bits *b, int startIx, int bitCount) |
| Find the index of the the next clear bit.
|
int | bitFindSet (Bits *b, int startIx, int bitCount) |
| Find the index of the the next set bit.
|
void | bitFree (Bits **pB) |
| Free bits.
|
void | bitNot (Bits *a, int bitCount) |
| Flip all bits in a.
|
void | bitOr (Bits *a, Bits *b, int bitCount) |
| Or two bitmaps.
|
void | bitPrint (Bits *a, int startIx, int bitCount) |
| Print part or all of bit map as a string of 0s and 1s.
|
int | bitReadOne (Bits *b, int bitIx) |
| Read a single bit.
|
Bits * | bitRealloc (Bits *b, int bitCount, int newBitCount) |
| Resize a bit array.
|
void | bitSetOne (Bits *b, int bitIx) |
| Set a single bit.
|
void | bitSetRange (Bits *b, int startIx, int bitCount) |
| Set a range of bits.
|
void | bitsInByteInit (void) |
| Initialize bitsInByte array.
|
void | bitXor (Bits *a, Bits *b, int bitCount) |
| Xor two bitmaps.
|
Detailed Description
Handle operations on arrays of bits.
- Author:
- Adapted by Lukas Habegger (lukas.habegger@yale.edu)
Definition in file bits.c.
Function Documentation
void bitAnd |
( |
Bits * |
a, |
|
|
Bits * |
b, |
|
|
int |
bitCount | |
|
) |
| | |
And two bitmaps.
Put result in a.
Definition at line 284 of file bits.c.
void bitOr |
( |
Bits * |
a, |
|
|
Bits * |
b, |
|
|
int |
bitCount | |
|
) |
| | |
Or two bitmaps.
Put result in a.
Definition at line 299 of file bits.c.
void bitPrint |
( |
Bits * |
a, |
|
|
int |
startIx, |
|
|
int |
bitCount | |
|
) |
| | |
Print part or all of bit map as a string of 0s and 1s.
Mostly useful for debugging
Definition at line 345 of file bits.c.
Bits* bitRealloc |
( |
Bits * |
b, |
|
|
int |
bitCount, |
|
|
int |
newBitCount | |
|
) |
| | |
Resize a bit array.
If b is null, allocate a new array
Definition at line 74 of file bits.c.
void bitXor |
( |
Bits * |
a, |
|
|
Bits * |
b, |
|
|
int |
bitCount | |
|
) |
| | |
Xor two bitmaps.
Put result in a.
Definition at line 314 of file bits.c.