BitManipulator Class Reference
#include <bitmanipulator.h>
List of all members.
Detailed Description
This is used to make it easy to work with bits.
- Author:
- John Schneiderman
|
Static Public Member Functions |
static string | base10ToBase2 (long number) |
static vector< string > | binarySequence (int length) |
static unsigned | mask (int maskLength, short maskStart) |
static void | printBits (unsigned variable, int numberBits, int breakUp) |
Member Function Documentation
string BitManipulator::base10ToBase2 |
( |
long |
number |
) |
[static] |
Creates a representation of a base 10 number in base 2.
- Parameters:
-
| number | is the base 10 number you wish to convert. |
- Returns:
- a string that represents the base 2 number equivalent.
vector< string > BitManipulator::binarySequence |
( |
int |
length |
) |
[static] |
Generates a bit sequence.
- Parameters:
-
| length | is the number of bits to generate the sequence to. |
- Returns:
- an array filled with the numbers starting from 1 to length in base 2.
unsigned BitManipulator::mask |
( |
int |
maskLength, |
|
|
short |
maskStart | |
|
) |
| | [static] |
Creates a bit extraction mask.
- Parameters:
-
| maskLength | is how many bits you want your mask to be. |
| maskStart | is where the first bit is that you wish to start extracting from. |
- Returns:
- the mask bit pattern needed to extract a sequence of bits.
void BitManipulator::printBits |
( |
unsigned |
variable, |
|
|
int |
numberBits, |
|
|
int |
breakUp | |
|
) |
| | [static] |
Prints out the bit pattern of a variable.
- Parameters:
-
| variable | is the variable whose bits you wish to display. |
| numberBits | is how many bits of the variable to print out to. |
| breakUp | is how the bits should be grouped. |
The documentation for this class was generated from the following files:
- gamebase/bitmanipulator.h
- gamebase/bitmanipulator.cpp