#include <libecc/bitset.h>
Inheritance diagram for libecc::bitset< n >:
Public Types | |
typedef bitset_iterator< n, forwards_iterating > | const_iterator |
Non-mutable iterator. | |
typedef bitset_iterator< n, backwards_iterating > | const_reverse_iterator |
Reverse non-mutable iterator. | |
Public Member Functions | |
bitset (void) | |
Construct an uninitialized bitset of n bits. | |
bitset (std::string const &) | |
Construct a bitset of n bits and initialize it with the string input, a hexadecimal value in ASCII representation. | |
bitset (bitset_digit_t low_bits) | |
Construct a bitset of which only the least significant bits are set. | |
bitset (bitset_digit_t const(&v)[bitset_base< n >::digits]) | |
Construct a bitset directly from an array of bitset_digit_t. | |
template<unsigned int m, bool inverted> | bitset (bitset_invertible< m, inverted > const &) |
Copy constructor. | |
template<unsigned int m, bool i1, bool i2, typename OP> | bitset (Operator::bitsetExpression< m, i1, i2, OP > const &expr) |
Construct a bitset from an expression. | |
template<typename Expression> bitset & | operator= (Expression const &) |
Assignment operator. | |
template<typename Expression> bitset & | operator &= (Expression const &) |
Assignment operator with bitwise AND. | |
template<typename Expression> bitset & | operator|= (Expression const &) |
Assignment operator with bitwise OR. | |
template<typename Expression> bitset & | operator^= (Expression const &) |
Assignment operator with bitwise XOR. | |
template<unsigned int shift, class DIRECTION, class OPERATION> void | shift_op (bitset &result) const |
Perform a shift operation followed by a bit operation. | |
bitset & | operator<<= (unsigned int shift) |
Shift bitset shift bits to the left. Use the faster bitset::shift_op for constant distance shifts. | |
bitset & | operator>>= (unsigned int shift) |
Shift bitset shift bits to the right. Use the faster bitset::shift_op for constant distance shifts. | |
template<unsigned int shift, class DIRECTION> void | rotate (bitset &result) const |
Rotate bitset. | |
bool | test (size_t n) const |
Test bit at position pos. | |
bool | odd (void) const |
Returns true when the bitset contains an odd number of bits. | |
void | set (size_t n) |
Set bit at position pos. | |
void | clear (size_t n) |
Clear bit at position pos. | |
void | flip (size_t n) |
Toggle bit at position pos. | |
bool | test (bitset_index const &index) const |
Test a bit at position index. | |
void | set (bitset_index const &index) |
Set bit at position index. | |
void | clear (bitset_index const &index) |
Clear bit at position index. | |
void | flip (bitset_index const &index) |
Toggle bit at position index. | |
template<unsigned int pos> bool | test (void) const |
Test a bit at a fixed position. | |
template<unsigned int pos> void | set (void) |
Set a bit at a fixed position. | |
template<unsigned int pos> void | clear (void) |
Clear a bit at a fixed position. | |
template<unsigned int pos> void | flip (void) |
Toggle a bit at a fixed position. | |
bitset & | reset (void) |
Reset all bits to 0. | |
void | setall (void) |
Set all bits to 1. | |
bool | any (void) const |
Return true if any bit is set. | |
const_iterator | begin (void) const |
Return an iterator to the first bit. | |
const_iterator | end (void) const |
Return an iterator one past the last bit. | |
const_reverse_iterator | rbegin (void) const |
Return a reverse iterator to bit n-1. | |
const_reverse_iterator | rend (void) const |
Return a reverse iterator one before the first bit. | |
template<unsigned int m> void | xor_with_zero_padded (bitset< m > const &bitset, int lsb, int msb, int shift) |
Shift bitset left or right and XOR with this bitset. |
n | The number of bits in the bitset. |
|
Non-mutable iterator.
|
|
Reverse non-mutable iterator.
|
|
Construct an uninitialized bitset of n bits.
|
|
Construct a bitset of n bits and initialize it with the string input, a hexadecimal value in ASCII representation. Input is a string of alphanumeric characters ([0-9A-F]) not case sensitive. The input string is read right to left. Any non-space character that is not a hexadecimal digit will terminate reading.
Spaces will be ignored, allowing one to write for example " If the value passed is larger than fits in the bitset then the most significant bits (the left most characters) are ignored as if the value did fit and then a bit-wise AND was performed with a bitset of n 1's.
|
|
Construct a bitset of which only the least significant bits are set. low_bits must never have more bits set than the size of the bitset n. |
|
Construct a bitset directly from an array of bitset_digit_t. The excess bits of the most significant digit (if any) must be zero. |
|
Copy constructor. The least significant bit (at position 0) of bits and the constructed bitset are lined up. If bits is wider than the constructed bitset then excess bits are lost; if narrower then missing bits are set to inverted. That is, set to zero when bits is not inverted and set to one when bits represents an inverted bitset. For example, when x is "0000000010001111" (16 bits), y is "10000000" (8 bits), then
results in x being "1111111111110000". |
|
Construct a bitset from an expression.
|
|
Return true if any bit is set.
|
|
Return an iterator to the first bit.
|
|
Clear a bit at a fixed position.
|
|
Clear bit at position index.
|
|
Clear bit at position pos.
|
|
Return an iterator one past the last bit.
|
|
Toggle a bit at a fixed position.
|
|
Toggle bit at position index.
|
|
Toggle bit at position pos.
|
|
Returns true when the bitset contains an odd number of bits.
|
|
Assignment operator with bitwise AND.
|
|
Shift bitset shift bits to the left. Use the faster bitset::shift_op for constant distance shifts.
|
|
Assignment operator. The least significant bits (at position 0) of expr and this bitset are lined up. If expr is wider than this bitset then excess bits are lost; if narrower then missing bits are set to zero or one depending on whether the expression contains inversion bits. For example, when x is "0000000010001111" (16 bits), y is "10000000" (8 bits) and z is "11110110" (8 bits), then
results in x being "1111111111110000". And
results in x being "0000000001110110". |
|
Shift bitset shift bits to the right. Use the faster bitset::shift_op for constant distance shifts.
|
|
Assignment operator with bitwise XOR.
|
|
Assignment operator with bitwise OR.
|
|
Return a reverse iterator to bit n-1.
|
|
Return a reverse iterator one before the first bit.
|
|
Reset all bits to 0.
|
|
Rotate bitset. Rotate bitset shift bits in DIRECTION.
|
|
Set a bit at a fixed position.
|
|
Set bit at position index.
|
|
Set bit at position pos.
|
|
Set all bits to 1.
|
|
Perform a shift operation followed by a bit operation. Shift this object shift bits in DIRECTION and then perform operation OPERATION on result with it.
|
|
Test a bit at a fixed position.
|
|
Test a bit at position index.
|
|
Test bit at position pos.
|
|
Shift bitset left or right and XOR with this bitset.
|