ROSE
0.11.96.11
|
Bit vectors.
This class implements bit vectors with run-time sizes and a rich set of operations that can be restricted to a contiguous subset of bits. The primary goal of this class is not to provide the utmost performance, but rather a rich, easy-to-use interface. For example,
In general, each method has a number of overloaded varieties: if a BitRange is not specified it generally means the entire bit vector; if a second bit vector is not specified for binary operations it generally means use this vector for both operands. Non-const operations modify this
vector in place, and most of them also return a reference so that they can be easily chained:
When performing an operation that has two operands, the operands are generally permitted to both refer to the same vector, and the range arguments are permitted to overlap in that vector. When this occurs, the semantics are as if a temporary copy was made, then the operation was performed on the temporary copy, then the result was written back to the destination.
BitVector objects manage their own data, but if one needs to operate on an array that is already allocated then the function templates in the BitVectorSupport name space can be used.
Definition at line 64 of file BitVector.h.
#include <BitVector.h>
Public Types | |
typedef unsigned | Word |
Base storage type. | |
typedef BitVectorSupport::BitRange | BitRange |
Describes an inclusive interval of bit indices. | |
Public Member Functions | |
BitVector () | |
Default construct an empty vector. | |
BitVector (const BitVector &other) | |
Copy constructor. | |
BitVector (size_t nbits, bool newBits=false) | |
Create a vector of specified size. More... | |
BitVector & | operator= (const BitVector &other) |
Assignment. More... | |
bool | isEmpty () const |
Determines if the vector is empty. More... | |
size_t | size () const |
Size of vector in bits. More... | |
BitVector & | resize (size_t newSize, bool newBits=false) |
Change vector size. More... | |
size_t | capacity () const |
Maximum size before reallocation. More... | |
BitRange | hull () const |
Interval representing the entire vector. More... | |
bool | get (size_t idx) const |
Retrieve one bit. More... | |
BitVector & | clear (const BitRange &range) |
Assign zero to some bits. More... | |
BitVector & | clear () |
Assign zero to all bits. More... | |
BitVector & | set (const BitRange &range) |
Assign true to some bits. More... | |
BitVector & | set () |
Assign true to all bits. More... | |
BitVector & | setValue (const BitRange &range, bool value) |
Assign true/false to some bits. More... | |
BitVector & | setValue (bool value) |
Assign true/false to all bits. More... | |
BitVector & | copy (const BitRange &to, const BitVector &other, const BitRange &from) |
Copy some bits. More... | |
BitVector & | copy (const BitRange &to, const BitRange &from) |
Copy some bits. More... | |
BitVector & | swap (const BitRange &range1, BitVector &other, const BitRange &range2) |
Swap some bits. More... | |
BitVector & | swap (const BitRange &range1, const BitRange &range2) |
Swap some bits. More... | |
bool | equalTo (const BitRange &range1, BitVector &other, const BitRange &range2) const |
Checks whether two ranges are equal. More... | |
bool | equalTo (const BitRange &range1, const BitRange &range2) const |
Checks whether the bits of two ranges are equal. More... | |
bool | equalTo (const BitVector &other) const |
Checks whether the bits of one vector are equal to the bits of the other. More... | |
Optional< size_t > | leastSignificantSetBit (const BitRange &range) const |
Find the least significant set bit. More... | |
Optional< size_t > | leastSignificantSetBit () const |
Find the least significant set bit. More... | |
Optional< size_t > | leastSignificantClearBit (const BitRange &range) const |
Find the least significant clear bit. More... | |
Optional< size_t > | leastSignificantClearBit () const |
Find the least significant clear bit. More... | |
Optional< size_t > | mostSignificantSetBit (const BitRange &range) const |
Find the most significant set bit. More... | |
Optional< size_t > | mostSignificantSetBit () const |
Find the most significant set bit. More... | |
Optional< size_t > | mostSignificantClearBit (const BitRange &range) const |
Find the most significant clear bit. More... | |
Optional< size_t > | mostSignificantClearBit () const |
Find the most significant clear bit. More... | |
bool | isAllSet (const BitRange &range) const |
True if all bits are set. More... | |
bool | isAllSet () const |
True if all bits are set. More... | |
bool | isAllClear (const BitRange &range) const |
True if all bits are clear. More... | |
bool | isAllClear () const |
True if all bits are clear. More... | |
size_t | nSet (const BitRange &range) const |
Number of set bits. More... | |
size_t | nSet () const |
Number of set bits. More... | |
size_t | nClear (const BitRange &range) const |
Number of clear bits. More... | |
size_t | nClear () const |
Number of clear bits. More... | |
Optional< size_t > | mostSignificantDifference (const BitRange &range1, const BitVector &other, const BitRange &range2) const |
Find most significant difference. More... | |
Optional< size_t > | mostSignificantDifference (const BitRange &range1, const BitRange &range2) const |
Find most significant difference. More... | |
Optional< size_t > | mostSignificantDifference (const BitVector &other) const |
Find most significant difference. More... | |
Optional< size_t > | leastSignificantDifference (const BitRange &range1, const BitVector &other, const BitRange &range2) const |
Find least significant difference. More... | |
Optional< size_t > | leastSignificantDifference (const BitRange &range1, const BitRange &range2) const |
Find least significant difference. More... | |
Optional< size_t > | leastSignificantDifference (const BitVector &other) const |
Find least significant difference. More... | |
BitVector & | shiftLeft (const BitRange &range, size_t nShift, bool newBits=0) |
Shift bits left. More... | |
BitVector & | shiftLeft (size_t nShift, bool newBits=0) |
Shift bits left. More... | |
BitVector & | shiftRight (const BitRange &range, size_t nShift, bool newBits=0) |
Shift bits right. More... | |
BitVector & | shiftRight (size_t nShift, bool newBits=0) |
Shift bits right. More... | |
BitVector & | shiftRightArithmetic (const BitRange &range, size_t nShift) |
Shift bits right. More... | |
BitVector & | shiftRightArithmetic (size_t nShift) |
Shift bits right. More... | |
BitVector & | rotateRight (const BitRange &range, size_t nShift) |
Rotate bits right. More... | |
BitVector & | rotateRight (size_t nShift) |
Rotate bits right. More... | |
BitVector & | rotateLeft (const BitRange &range, size_t nShift) |
Rotate bits left. More... | |
BitVector & | rotateLeft (size_t nShift) |
Rotate bits left. More... | |
BitVector & | negate (const BitRange &range1) |
Negates bits as integer. More... | |
BitVector & | negate () |
Negates bits as integer. More... | |
bool | increment (const BitRange &range1) |
Increment bits as integer. More... | |
bool | increment () |
Increment bits as integer. More... | |
bool | decrement (const BitRange &range1) |
Decrement bits as integer. More... | |
bool | decrement () |
Decrement bits as integer. More... | |
bool | add (const BitRange &range1, const BitVector &other, const BitRange &range2) |
Add bits as integers. More... | |
bool | add (const BitRange &range1, const BitRange &range2) |
Add bits as integers. More... | |
bool | add (const BitVector &other) |
Add bits as integers. More... | |
bool | subtract (const BitRange &range1, const BitVector &other, const BitRange &range2) |
Subtract bits as integers. More... | |
bool | subtract (const BitRange &range1, const BitRange &range2) |
Subtract bits as integers. More... | |
bool | subtract (const BitVector &other) |
Subtract bits as integers. More... | |
BitVector & | signExtend (const BitRange &range1, const BitVector &other, const BitRange &range2) |
Copy bits and sign extend. More... | |
BitVector & | signExtend (const BitRange &range1, const BitRange &range2) |
Copy bits and sign extend. More... | |
BitVector & | signExtend (const BitVector &other) |
Copy bits and sign extend. More... | |
BitVector & | multiply10 () |
Multiply by 10. More... | |
BitVector & | multiply10 (const BitRange &range) |
Multiply by 10. More... | |
BitVector | multiply (const BitVector &other) const |
Multiply two bit vectors. More... | |
BitVector | multiplySigned (const BitVector &other) const |
Multiply two signed integers. More... | |
BitVector & | invert (const BitRange &range) |
Invert bits. More... | |
BitVector & | invert () |
Invert bits. More... | |
BitVector & | bitwiseAnd (const BitRange &range1, const BitVector &other, const BitRange &range2) |
Bit-wise AND. More... | |
BitVector & | bitwiseAnd (const BitRange &range1, const BitRange &range2) |
Bit-wise AND. More... | |
BitVector & | bitwiseAnd (const BitVector &other) |
Bit-wise AND. More... | |
BitVector & | bitwiseOr (const BitRange &range1, const BitVector &other, const BitRange &range2) |
Bit-wise OR. More... | |
BitVector & | bitwiseOr (const BitRange &range1, const BitRange &range2) |
Bit-wise OR. More... | |
BitVector & | bitwiseOr (const BitVector &other) |
Bit-wise OR. More... | |
BitVector & | bitwiseXor (const BitRange &range1, const BitVector &other, const BitRange &range2) |
Bit-wise XOR. More... | |
BitVector & | bitwiseXor (const BitRange &range1, const BitRange &range2) |
Bit-wise XOR. More... | |
BitVector & | bitwiseXor (const BitVector &other) |
Bit-wise XOR. More... | |
bool | isEqualToZero (const BitRange &range) const |
Compare to zero. More... | |
bool | isEqualToZero () const |
Compare to zero. More... | |
int | compare (const BitRange &range1, const BitVector &other, const BitRange &range2) const |
Compare bits as integers. More... | |
int | compare (const BitRange &range1, const BitRange &range2) const |
Compare bits as integers. More... | |
int | compare (const BitVector &other) const |
Compare bits as integers. More... | |
int | compareSigned (const BitRange &range1, const BitVector &other, const BitRange &range2) const |
Compare bits as signed integers. More... | |
int | compareSigned (const BitRange &range1, const BitRange &range2) const |
Compare bits as signed integers. More... | |
int | compareSigned (const BitVector &other) const |
Compare bits as signed integers. More... | |
boost::uint64_t | toInteger (const BitRange &range) const |
Interpret bits as an unsigned integer. More... | |
boost::uint64_t | toInteger () const |
Interpret bits as an unsigned integer. More... | |
boost::int64_t | toSignedInteger (const BitRange &range) const |
Interpret bits as a signed integer. More... | |
boost::int64_t | toSignedInteger () const |
Interpret bits as a signed integer. More... | |
std::string | toHex (const BitRange &range) const |
Convert to a hexadecimal string. More... | |
std::string | toHex () const |
Convert to a hexadecimal string. More... | |
std::string | toOctal (const BitRange &range) const |
Convert to an octal string. More... | |
std::string | toOctal () const |
Convert to an octal string. More... | |
std::string | toBinary (const BitRange &range) const |
Convert to a binary string. More... | |
std::string | toBinary () const |
Convert to an binary string. More... | |
BitVector & | fromInteger (const BitRange &range, boost::uint64_t value) |
Obtain bits from an integer. More... | |
BitVector & | fromInteger (boost::uint64_t value) |
Obtain bits from an integer. More... | |
BitVector & | fromDecimal (const BitRange &range, const std::string &input) |
Obtains bits from a decimal representation. More... | |
BitVector & | fromDecimal (const std::string &input) |
Obtain bits from a decimal representation. More... | |
BitVector & | fromHex (const BitRange &range, const std::string &input) |
Obtain bits from a hexadecimal representation. More... | |
BitVector & | fromHex (const std::string &input) |
Obtain bits from a hexadecimal representation. More... | |
BitVector & | fromOctal (const BitRange &range, const std::string &input) |
Obtain bits from an octal representation. More... | |
BitVector & | fromOctal (const std::string &input) |
Obtain bits from an octal representation. More... | |
BitVector & | fromBinary (const BitRange &range, const std::string &input) |
Obtain bits from a binary representation. More... | |
BitVector & | fromBinary (const std::string &input) |
Obtain bits from a binary representation. More... | |
void | checkRange (const BitRange &range) const |
Assert valid range. More... | |
size_t | dataSize () const |
Raw data size. More... | |
Word * | data () |
Raw data for vector. More... | |
const Word * | data () const |
Raw data for vector. More... | |
Static Public Member Functions | |
static BitVector | parse (std::string str) |
Create a bit vector by reading a string. More... | |
static BitRange | baseSize (size_t base, size_t size) |
Create a bit range from a starting offset and size. More... | |
static BitRange | hull (size_t minOffset, size_t maxOffset) |
Create a bit range from min and max positions. More... | |
|
inlineexplicit |
Create a vector of specified size.
All bits in this vector will be set to the newBits
value.
Definition at line 91 of file BitVector.h.
References resize().
|
inlinestatic |
Create a bit vector by reading a string.
Reads a bit vector from the string and returns the result. The input string has an optional suffix ("h" for hexadecimal) or optioanl prefix ("0x" for hexadecimal, "0b" or binary, or "0" for octal). It does not have both; if a suffix is present then the parser does not search for a prefix. Lack of both prefix and suffix implies decimal format. Any recognized suffix or prefix is stripped from the value, and the number of valid digits is counted and used to calculate the width of the resulting bit vector. For instance, if three octal digits are found (not counting the "0" prefix) then the resulting bit vector will have nine bits – three per digit. The string is then passed to fromBinary, fromOctal, fromDecimal, or fromHex for parsing.
Definition at line 106 of file BitVector.h.
References fromBinary(), fromDecimal(), fromHex(), and fromOctal().
Assignment.
Makes this bit vector an exact copy of the other
vector.
Definition at line 175 of file BitVector.h.
|
inline |
Determines if the vector is empty.
Returns true if this vector contains no data.
Definition at line 184 of file BitVector.h.
|
inline |
Size of vector in bits.
Returns the size of this vector in bits.
Definition at line 189 of file BitVector.h.
Referenced by baseSize(), equalTo(), multiply(), multiplySigned(), toInteger(), and toSignedInteger().
|
inline |
Change vector size.
Changes the size of a vector, measured in bits, by either adding or removing bits from the most-significant side of this vector. If new bits are added they are each given the value newBits
. Increasing the size of a vector may cause it to reallocate and copy its internal data structures.
Definition at line 196 of file BitVector.h.
References data(), Sawyer::Container::Interval< size_t >::hull(), and Sawyer::Container::BitVectorSupport::setValue().
Referenced by BitVector(), multiply(), and multiplySigned().
|
inline |
Maximum size before reallocation.
Returns the maximum number of bits to which this vector could be resized via resize before it becomes necessary to reallocate its internal data structures.
Definition at line 217 of file BitVector.h.
|
inline |
Interval representing the entire vector.
Returns the smallest index interval that includes all bits.
Definition at line 224 of file BitVector.h.
References Sawyer::Container::Interval< size_t >::hull().
Referenced by add(), bitwiseAnd(), bitwiseOr(), bitwiseXor(), checkRange(), clear(), compare(), compareSigned(), decrement(), equalTo(), fromBinary(), fromDecimal(), fromHex(), fromInteger(), fromOctal(), increment(), invert(), isAllClear(), isAllSet(), isEqualToZero(), leastSignificantClearBit(), leastSignificantDifference(), leastSignificantSetBit(), mostSignificantClearBit(), mostSignificantDifference(), mostSignificantSetBit(), multiply10(), nClear(), negate(), nSet(), rotateLeft(), rotateRight(), set(), setValue(), shiftLeft(), shiftRight(), shiftRightArithmetic(), signExtend(), subtract(), toBinary(), toHex(), toInteger(), toOctal(), and toSignedInteger().
|
inlinestatic |
Create a bit range from a starting offset and size.
This is just a convenience wrapper around BitRange::baseSize() so that name qualification can be avoided when "using namespace" directives are not employed.
Definition at line 232 of file BitVector.h.
References Sawyer::Container::Interval< size_t >::baseSize(), and size().
|
inlinestatic |
Create a bit range from min and max positions.
This is just a convenience wrapper around BitRange::hull(size_t,size_t) so that name qualification can be avoided when "using namespace" directives are not employed.
Definition at line 240 of file BitVector.h.
References Sawyer::Container::Interval< size_t >::hull().
|
inline |
Retrieve one bit.
Returns the value of the bit at the specified index in constant time. The index must be a valid index for this vector.
Definition at line 252 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::get().
Referenced by Sawyer::Container::Algorithm::GraphTraversal< Graph, BreadthFirstTraversalTag, ForwardTraversalTag >::isDiscovered(), Sawyer::Container::Algorithm::GraphTraversal< Graph, BreadthFirstTraversalTag, ForwardTraversalTag >::isVisited(), multiply(), and multiplySigned().
Assign zero to some bits.
Clears bits by assigning false to each bit in the specified range. The convention is that "clear" means to assign false to a bit and should not be confused with the STL usage of the word, namely to erase all values from a container. To erase all bits from a vector, use resize(0)
.
Definition at line 262 of file BitVector.h.
References checkRange(), Sawyer::Container::BitVectorSupport::clear(), and data().
|
inline |
Assign zero to all bits.
Clears bits by assigning false to all bits in this vector. The convention is that "clear" means to assign false to to a bit and should not be confused with the STL usage of the word, namely to erase all values from a container. To erase all bits from a vector, use resize(0)
.
Definition at line 273 of file BitVector.h.
References Sawyer::Container::BitVectorSupport::clear(), data(), and hull().
Assign true to some bits.
Sets bits by assigning true (or newBits
) to each bit in the specified range. The convention is that "set" means to assign true to a bit; to assign a specific value use setValue.
Definition at line 282 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::set().
|
inline |
Assign true to all bits.
Sets bits by assigning true (or newBits
) to all bits in this vector. The convention is that "set" means to assign true to a bit; to assign a specific value use setValue.
Definition at line 292 of file BitVector.h.
References data(), hull(), and Sawyer::Container::BitVectorSupport::set().
Assign true/false to some bits.
Sets the bits in the specified range to the specified value.
Definition at line 300 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::setValue().
|
inline |
Assign true/false to all bits.
Sets all bits to the specified value.
Definition at line 309 of file BitVector.h.
References data(), hull(), and Sawyer::Container::BitVectorSupport::setValue().
|
inline |
Copy some bits.
Copies bits from other
specified by from
into this vector specified by to
. The ranges must be the same size and must be valid for their respective vectors. The other
vector is permitted to be the same vector as this
, in which case from
is also permitted to overlap with to
.
Definition at line 321 of file BitVector.h.
References checkRange(), Sawyer::Container::BitVectorSupport::copy(), and data().
Copy some bits.
Copies bits from the range from
to the range to
. Both ranges must be the same size, and they may overlap.
Definition at line 333 of file BitVector.h.
References checkRange(), Sawyer::Container::BitVectorSupport::copy(), and data().
|
inline |
Swap some bits.
Swaps bits between range1
of this vector and range2
of the other
vector. Both ranges must be the same size and must be valid for their respective vectors. The other
vector is permitted to be the same vector as this
, but range1
and range2
are not permitted to overlap.
Definition at line 345 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::swap().
|
inline |
Swap some bits.
Swaps bits between range1
and range2
of this vector. Both ranges must be the same size, and must be valid for this vector, and must not overlap.
Definition at line 356 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::swap().
|
inline |
Checks whether two ranges are equal.
Returns true if the bits of the first range are equal to the bits in the second range.
Definition at line 366 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::equalTo().
|
inline |
Checks whether the bits of two ranges are equal.
Returns true if the bits contained in the first range match the bits contained in the second range. If the ranges are different sizes then returns false.
Definition at line 376 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::equalTo().
|
inline |
Checks whether the bits of one vector are equal to the bits of the other.
If the vectors are different sizes then they are considered to be unequal regardless of their content. See also, compare.
Definition at line 386 of file BitVector.h.
References data(), Sawyer::Container::BitVectorSupport::equalTo(), hull(), and size().
|
inline |
Find the least significant set bit.
Returns the index for the least significant bit that has the value true in the specified range. The range must be valid for this vector. If the range has no such bits, including the case when the range is empty, then nothing is returned.
Definition at line 401 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::leastSignificantSetBit().
|
inline |
Find the least significant set bit.
Returns the index for the least significant bit that has the value true. If no bit is true, including the case when the vector is empty, then nothing is returned.
Definition at line 410 of file BitVector.h.
References data(), hull(), and Sawyer::Container::BitVectorSupport::leastSignificantSetBit().
|
inline |
Find the least significant clear bit.
Returns the index for the least significant bit that has the value false in the specified range. The range must be valid for this vector. If the range has no such bits, including the case when the range is empty, then nothing is returned.
Definition at line 419 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::leastSignificantClearBit().
|
inline |
Find the least significant clear bit.
Returns the index for the least significant bit that has the value false. If no bit is false, including the case when the vector is empty, then nothing is returned.
Definition at line 428 of file BitVector.h.
References data(), hull(), and Sawyer::Container::BitVectorSupport::leastSignificantClearBit().
|
inline |
Find the most significant set bit.
Returns the index for the most significant bit that has the value true in the specified range. The range must be valid for this vector. If the range has no such bits, including the case when the range is empty, then nothing is returned.
Definition at line 437 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::mostSignificantSetBit().
|
inline |
Find the most significant set bit.
Returns the index for the most significant bit that has the value true. If no bit is true, including the case when the vector is empty, then nothing is returned.
Definition at line 446 of file BitVector.h.
References data(), hull(), and Sawyer::Container::BitVectorSupport::mostSignificantSetBit().
|
inline |
Find the most significant clear bit.
Returns the index for the most significant bit that has the value false in the specified range. The range must be valid for this vector. If the range has no such bits, including the case when the range is empty, then nothing is returned.
Definition at line 455 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::mostSignificantClearBit().
|
inline |
Find the most significant clear bit.
Returns the index for the most significant bit that has the value false. If no bit is false, including the case when the vector is empty, then nothing is returned.
Definition at line 464 of file BitVector.h.
References data(), hull(), and Sawyer::Container::BitVectorSupport::mostSignificantClearBit().
|
inline |
True if all bits are set.
Returns true if all bits are set within the specified range, or if the range is empty. The range must be valid for this vector.
Definition at line 472 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::isAllSet().
|
inline |
True if all bits are set.
Returns true if all bits are set, or if the vector is empty.
Definition at line 480 of file BitVector.h.
References data(), hull(), and Sawyer::Container::BitVectorSupport::isAllSet().
|
inline |
True if all bits are clear.
Returns true if all bits are clear within the specified range, or if the range is empty. The range must be valid for this vector.
Definition at line 490 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::isAllClear().
|
inline |
True if all bits are clear.
Returns true if all bits are clear, or if the vector is empty.
Definition at line 500 of file BitVector.h.
References data(), hull(), and Sawyer::Container::BitVectorSupport::isAllClear().
|
inline |
Number of set bits.
Returns the number of bits that are set in the specified range. The range must be valid for this vector.
Definition at line 507 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::nSet().
|
inline |
Number of set bits.
Returns the number of bits that are set.
Definition at line 515 of file BitVector.h.
References data(), hull(), and Sawyer::Container::BitVectorSupport::nSet().
|
inline |
Number of clear bits.
Returns the number of bits that are clear in the specified range. The range must be valid for this vector.
Definition at line 522 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::nClear().
|
inline |
Number of clear bits.
Returns the number of bits that are clear.
Definition at line 530 of file BitVector.h.
References data(), hull(), and Sawyer::Container::BitVectorSupport::nClear().
|
inline |
Find most significant difference.
Finds the most significant bit that differs between range1
of this vector and range2
of the other
vector and returns its offset from the beginning of the ranges. Both ranges must be the same size and must be valid for their respective vectors. If no bits differ, including the case when both ranges are empty, then nothing is returned. The other
vector is permitted to be the same as this
vector, in which case the ranges are also permitted to overlap.
Note that the return value is not a vector index, but rather an offset with respect to the starting index in each of the ranges.
Definition at line 544 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::mostSignificantDifference().
|
inline |
Find most significant difference.
Finds the most significant bit that differs between the two specified ranges of this vector and returns its offset from the beginning of the ranges. Both ranges must be the same size and must be valid for this vector. If no bits differ, including the case when both ranges are empty, then nothing is returned. The ranges are permitted to overlap.
Note that the return value is not a vector index, but rather an offset with respect to the starting index in each of the ranges.
Definition at line 559 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::mostSignificantDifference().
|
inline |
Find most significant difference.
Finds the most significant bit that differs between this vector and the other
vector and return its index. Both vectors must be the same size. If no bits differ, including the case when this vector is empty, then nothing is returned.
Definition at line 570 of file BitVector.h.
References data(), hull(), and Sawyer::Container::BitVectorSupport::mostSignificantDifference().
|
inline |
Find least significant difference.
Finds the least significant bit that differs between range1
of this vector and range2
of the other
vector and returns its offset from the beginning of the ranges. Both ranges must be the same size and must be valid for their respective vectors. If no bits differ, including the case when both ranges are empty, then nothing is returned. The other
vector is permitted to be the same as this
vector, in which case the ranges are also permitted to overlap.
Note that the return value is not a vector index, but rather an offset with respect to the starting index in each of the ranges.
Definition at line 584 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::leastSignificantDifference().
|
inline |
Find least significant difference.
Finds the least significant bit that differs between the two specified ranges of this vector and returns its offset from the beginning of the ranges. Both ranges must be the same size and must be valid for this vector. If no bits differ, including the case when both ranges are empty, then nothing is returned. The ranges are permitted to overlap.
Note that the return value is not a vector index, but rather an offset with respect to the starting index in each of the ranges.
Definition at line 599 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::leastSignificantDifference().
|
inline |
Find least significant difference.
Finds the least significant bit that differs between this vector and the other
vector and return its index. Both vectors must be the same size. If no bits differ, including the case when this vector is empty, then nothing is returned.
Definition at line 610 of file BitVector.h.
References data(), hull(), and Sawyer::Container::BitVectorSupport::leastSignificantDifference().
|
inline |
Shift bits left.
Shifts the bits in the specified range of this vector left (to more significant positions) by nShift
bits. Bits shifted off the left of the range are discarded; new bits shifted into the right of the range are introduced with the value newBits
. The range must be valid for this vector. If nShift
is zero or the range is empty then no operation is performed. Specifying an nShift
value equal to or greater than the size of the range has the same effect as filling the range with newBits
(see also, set and clear, which are probably more efficient).
Definition at line 625 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::shiftLeft().
Referenced by multiply(), and multiplySigned().
|
inline |
Shift bits left.
Shifts all bits of this vector left (to more significant positions) by nShift
bits. Bits shifted off the left of this vector are discarded; new bits shifted into the right of this vector are introduced with the value newBits
. If nShift
is zero or the vector is empty then no operation is performed. Specifying an nShift
value equal to or greater than the size of this vector has the same effect as filling the vector with newBits
(see also, set and clear, which are probably more efficient).
Definition at line 638 of file BitVector.h.
References data(), hull(), and Sawyer::Container::BitVectorSupport::shiftLeft().
|
inline |
Shift bits right.
Shifts the bits in the specified range of this vector right (to less significant positions) by nShift
bits. Bits shifted off the right of the range are discarded; new bits shifted into the left of the range are introduced with the value newBits
. The range must be valid for this vector. If nShift
is zero or the range is empty then no operation is performed. Specifying an nShift
value equal to or greater than the size of the range has the same effect as filling the range with newBits
(see also, set and clear, which are probably more efficient).
Definition at line 650 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::shiftRight().
|
inline |
Shift bits right.
Shifts all bits of this vector right (to less significant positions) by nShift
bits. Bits shifted off the right of this vector are discarded; new bits shifted into the left of this vector are introduced with the value newBits
. If nShift
is zero or the vector is empty then no operation is performed. Specifying an nShift
value equal to or greater than the size of this vector has the same effect as filling the vector with newBits
(see also, set and clear, which are probably more efficient).
Definition at line 663 of file BitVector.h.
References data(), hull(), and Sawyer::Container::BitVectorSupport::shiftRight().
|
inline |
Shift bits right.
Shifts the bits in the specified range of this vector right (to less significant positions) by nShift
bits. Bits shifted off the right of the range are discarded; new bits shifted into the left of the range are introduced with the same value as the original most-significant bit of the range. The range must be valid for this vector. If nShift
is zero or the range is empty or a singleton then no operation is performed. Specifying an nShift
value equal to or greater than the size of the range has the same effect as filling the range with its original most-significant bit (see also, set and clear, which are probably more efficient).
Definition at line 676 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::shiftRightArithmetic().
|
inline |
Shift bits right.
Shifts the bits in this vector right (to less significant positions) by nShift
bits. Bits shifted off the right of this vector are discarded; new bits shifted into the left of this vector are introduced with the same value as the original most-significant bit of this vector. If nShift
is zero or the vector is empty or only a single bit then no operation is performed. Specifying an nShift
value equal to or greater than the size of this vector has the same effect as filling the vector with its original most-significant bit (see also, set and clear, which are probably more efficient).
Definition at line 690 of file BitVector.h.
References data(), hull(), and Sawyer::Container::BitVectorSupport::shiftRightArithmetic().
|
inline |
Rotate bits right.
Rotates the bits in the specified range to the right (to less significant positions) by shifting right and reintroducing the bits shifted off the right end into the left end. The range must be valid for this vector. If nShift
is zero modulo the range size, or the range is empty, then no operation is performed.
Definition at line 700 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::rotateRight().
|
inline |
Rotate bits right.
Rotates all bits in this vector to the right (to less significant positions) by shifting right and reintroducing the bits shifted off the right end into the left end. If nShift
is zero modulo this vector size, or this vector is empty, then no operation is performed.
Definition at line 711 of file BitVector.h.
References data(), hull(), and Sawyer::Container::BitVectorSupport::rotateRight().
|
inline |
Rotate bits left.
Rotates the bits in the specified range to the left (to more significant positions) by shifting left and reintroducing the bits shifted off the left end into the right end. The range must be valid for this vector. If nShift
is zero modulo the range size, or the range is empty, then no operation is performed.
Definition at line 721 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::rotateLeft().
|
inline |
Rotate bits left.
Rotates all bits in this vector to the left (to more significant positions) by shifting left and reintroducing the bits shifted off the left end into the right end. If nShift
is zero modulo this vector size, or this vector is empty, then no operation is performed.
Definition at line 732 of file BitVector.h.
References data(), hull(), and Sawyer::Container::BitVectorSupport::rotateLeft().
Negates bits as integer.
Treats range1
of this vector as a two's complement integer and negates it, storing the result back into the same range of bits. The range must be valid for this vector.
Definition at line 745 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::negate().
Referenced by multiplySigned().
|
inline |
Negates bits as integer.
Treats all bits of this vector as a two's complement integer and negates it, storing the result back into this vector.
Definition at line 755 of file BitVector.h.
References data(), hull(), and Sawyer::Container::BitVectorSupport::negate().
|
inline |
Increment bits as integer.
Treats range1
of this vector as an integer and adds one to it, storing the result back into this vector. The range must be valid for this vector. Returns true if all bits were originally set and the result is all clear (i.e., returns the carry-out value) .
Definition at line 765 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::increment().
|
inline |
Increment bits as integer.
Treats the entire vector as an integer and adds one to it, storing the result back into the vector. Returns true if all bits were originally set and the result is all clear (i.e., returns the carry-out value).
Definition at line 774 of file BitVector.h.
References data(), hull(), and Sawyer::Container::BitVectorSupport::increment().
|
inline |
Decrement bits as integer.
Treats range1
of this vector as an integer and subtracts one from it, storing the result back into this vector. The range must be valid for this vector. Returns true if all bits were originally clear and the result is all set (i.e., returns the overflow bit) .
Definition at line 783 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::decrement().
|
inline |
Decrement bits as integer.
Treats the entire vector as an integer and subtracts one from it, storing the result back into the vector. Returns true if all bits were originally clear and the result is all set (i.e., returns the overflow bit).
Definition at line 792 of file BitVector.h.
References data(), Sawyer::Container::BitVectorSupport::decrement(), and hull().
|
inline |
Add bits as integers.
Treats range1
of this vector and range2
of the other
vector as integers, sums them, and stores the result in range1
of this vector. The ranges must be valid for their respective vectors, and both ranges must be the same size. The other
vector is permitted to be the same vector as this
, in which case the ranges are also permitted to overlap. Returns the final carry-out value which is not stored in the result.
Definition at line 802 of file BitVector.h.
References Sawyer::Container::BitVectorSupport::add(), checkRange(), and data().
Referenced by multiply(), and multiplySigned().
Add bits as integers.
Treats range1
and range2
of this vector as integers, sums them, and stores the result in range1
. The ranges must be valid for this vector and both ranges must be the same size. The are permitted to overlap. Returns the final carry-out value which is not stored in the result.
Definition at line 813 of file BitVector.h.
References Sawyer::Container::BitVectorSupport::add(), checkRange(), and data().
|
inline |
Add bits as integers.
Treats this vector and the other
vector as integers, sums them, and stores the result in this vector. Both vectors must be the same size. The other
vector is permitted to be the same as this
vector, in which case it numerically doubles the value (like a left shift by one bit). Returns the final carry-out value which is not stored in the result.
Definition at line 825 of file BitVector.h.
References Sawyer::Container::BitVectorSupport::add(), data(), and hull().
|
inline |
Subtract bits as integers.
Treats range1
of this vector and range2
of the other
vector as integers, subtracts other
from this
, and stores the result in range1
of this vector. The ranges must be valid for their respective vectors, and both ranges must be the same size. The other
vector is permitted to be the same vector as this
, in which case the ranges are also permitted to overlap. Returns false only when an overflow occurs (i.e., the integer interpretation of this vector is unsigned-greater-than the integer from the other
vector). If the vectors are interpreted as two's complement signed integers then an overflow is indicated when both operands have the same sign and the result has a different sign.
Definition at line 838 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::subtract().
|
inline |
Subtract bits as integers.
Treats range1
and range2
of this vector as integers, subtracts the integer in range2
from the integer in range1
, and stores the result in range1
of this vector. The ranges must be valid for this vector, and both ranges must be the same size. The ranges are permitted to overlap. Returns false only when an overflow occurs (i.e., the integer interpretation of range1
is unsigned-greater-than the integer from range2
). If the ranges are interpreted as containing two's complement signed integers then an overflow is indicated when both operands have the same sign and the result has a different sign.
Definition at line 852 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::subtract().
|
inline |
Subtract bits as integers.
Treats this vector and the other
vector as integers, subtracts other
from this
, and stores the result in this vector. Both vectors must be the same size. The other
vector is permitted to be the same as this
vector, in which case this vector is filled with zero.
Definition at line 863 of file BitVector.h.
References data(), hull(), and Sawyer::Container::BitVectorSupport::subtract().
|
inline |
Copy bits and sign extend.
Copies bits from range2
of the other
vector to range1
of this vector while sign extending. That is, if the destination is larger than the source, the most significant bit of the source is repeated to fill the high order bits of the destination. Both ranges must be valid for their respective vectors. The other
vector is permitted to be the same as this
vector, in which case the ranges are also permitted to overlap.
Definition at line 873 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::signExtend().
|
inline |
Copy bits and sign extend.
Copies bits from range2
of this vector to range1
of this vector while sign extending. That is, if the destination is larger than the source, the most significant bit of the source is repeated to fill the high order bits of the destination. Both ranges must be valid for this vector, and are permitted to overlap.
Definition at line 885 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::signExtend().
Copy bits and sign extend.
Copies bits from the other
vector to this vector while sign extending. That is, if the destination is larger than the source, the most significant bit of the source is repeated to fill the high order bits of the destination.
Definition at line 896 of file BitVector.h.
References data(), hull(), and Sawyer::Container::BitVectorSupport::signExtend().
|
inline |
Multiply by 10.
Threats this vector as an unsigned integer and multiplies it by 10. If the product doesn't fit in the same vector then the high order bits of the product are truncated.
Definition at line 905 of file BitVector.h.
References data(), hull(), and Sawyer::Container::BitVectorSupport::multiply10().
Multiply by 10.
Treats range
of this vector as an unsigned integer and multiplies it by 10, storing the result back into the same range, possibly truncating the result in the process.
Definition at line 914 of file BitVector.h.
References data(), and Sawyer::Container::BitVectorSupport::multiply10().
Multiply two bit vectors.
Multiplies this
bit vector with other
, both interpreted as unsigned integer, to produce a result bit vector whose width is the sum of the two input widths.
Definition at line 923 of file BitVector.h.
References add(), get(), resize(), shiftLeft(), and size().
Multiply two signed integers.
Multiplies this bit vector with other
, both interpreted as signed integers, to produce a result bit vector whose width is the sum of the two input widths.
Definition at line 939 of file BitVector.h.
References add(), get(), negate(), resize(), shiftLeft(), and size().
Invert bits.
Each bit in the specified range is inverted. The range must be valid for this vector.
Definition at line 985 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::invert().
|
inline |
Invert bits.
Each bit in this vector is inverted.
Definition at line 994 of file BitVector.h.
References data(), hull(), and Sawyer::Container::BitVectorSupport::invert().
|
inline |
Bit-wise AND.
Computes the bit-wise AND of range1
from this vector and range2
of the other
vector, storing the result in range1
. The ranges must be valid for their respective vectors and must be the same size. The other
vector is permitted to refer to this
vector, in which case the ranges are also permitted to overlap.
Definition at line 1004 of file BitVector.h.
References Sawyer::Container::BitVectorSupport::bitwiseAnd(), checkRange(), and data().
|
inline |
Bit-wise AND.
Computes the bit-wise AND of range1
and range2
of this vector, storing the result in range1
. The ranges must be valid for this vector and must be the same size. They are permitted to overlap.
Definition at line 1015 of file BitVector.h.
References Sawyer::Container::BitVectorSupport::bitwiseAnd(), checkRange(), and data().
Bit-wise AND.
Computes the bit-wise AND of this vector and the other
vector, storing the result in this vector. The vectors must be the same size.
Definition at line 1026 of file BitVector.h.
References Sawyer::Container::BitVectorSupport::bitwiseAnd(), data(), and hull().
|
inline |
Bit-wise OR.
Computes the bit-wise OR of range1
from this vector and range2
of the other
vector, storing the result in range1
. The ranges must be valid for their respective vectors and must be the same size. The other
vector is permitted to refer to this
vector, in which case the ranges are also permitted to overlap.
Definition at line 1036 of file BitVector.h.
References Sawyer::Container::BitVectorSupport::bitwiseOr(), checkRange(), and data().
|
inline |
Bit-wise OR.
Computes the bit-wise OR of range1
and range2
of this vector, storing the result in range1
. The ranges must be valid for this vector and must be the same size. They are permitted to overlap.
Definition at line 1047 of file BitVector.h.
References Sawyer::Container::BitVectorSupport::bitwiseOr(), checkRange(), and data().
Bit-wise OR.
Computes the bit-wise OR of this vector and the other
vector, storing the result in this vector. The vectors must be the same size.
Definition at line 1058 of file BitVector.h.
References Sawyer::Container::BitVectorSupport::bitwiseOr(), data(), and hull().
|
inline |
Bit-wise XOR.
Computes the bit-wise XOR of range1
from this vector and range2
of the other
vector, storing the result in range1
. The ranges must be valid for their respective vectors and must be the same size. The other
vector is permitted to refer to this
vector, in which case the ranges are also permitted to overlap.
Definition at line 1068 of file BitVector.h.
References Sawyer::Container::BitVectorSupport::bitwiseXor(), checkRange(), and data().
|
inline |
Bit-wise XOR.
Computes the bit-wise XOR of range1
and range2
of this vector, storing the result in range1
. The ranges must be valid for this vector and must be the same size. They are permitted to overlap.
Definition at line 1079 of file BitVector.h.
References Sawyer::Container::BitVectorSupport::bitwiseXor(), checkRange(), and data().
Bit-wise XOR.
Computes the bit-wise XOR of this vector and the other
vector, storing the result in this vector. The vectors must be the same size.
Definition at line 1090 of file BitVector.h.
References Sawyer::Container::BitVectorSupport::bitwiseXor(), data(), and hull().
|
inline |
Compare to zero.
Compares the integer value referred to by the specified range with zero. Returns true if the value is equal to zero the range is empty.
Definition at line 1105 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::isEqualToZero().
|
inline |
Compare to zero.
Returns true if this vector is empty all bits are false.
Definition at line 1115 of file BitVector.h.
References data(), hull(), and Sawyer::Container::BitVectorSupport::isEqualToZero().
|
inline |
Compare bits as integers.
Compares range1
from this vector with range2
from the other
vector as integers and returns a value whose sign indicates the ordering relationship between the two ranges. Returns negative if the range1
value is less than the range2
value, returns zero if they are equal, and returns positive if the range1
value is greater than the range2
value. The ranges must be valid for their respective vectors, and need not be the same size (the smaller range will be temporarily zero extended on its most significant end). An empty range is treated as zero. The other
vector is permitted to refer to this
vector, in which case the ranges are also permitted to overlap.
Definition at line 1127 of file BitVector.h.
References checkRange(), Sawyer::Container::BitVectorSupport::compare(), and data().
|
inline |
Compare bits as integers.
Compares range1
and range2
from this vector as integers and returns a value whose sign indicates the ordering relationship between the two ranges. Returns negative if the range1
value is less than the range2
value, returns zero if they are equal, and returns positive if the range1
value is greater than the range2
value. The ranges must be valid for this vector, and need not be the same size (the smaller range will be temporarily zero extended on its most significant end). An empty range is interpreted as zero. The ranges are permitted to overlap.
Definition at line 1140 of file BitVector.h.
References checkRange(), Sawyer::Container::BitVectorSupport::compare(), and data().
|
inline |
Compare bits as integers.
Compares the bits of this vector with the bits of other
as integers and returns a value whose sign indicates the ordering relationship between the two ranges. Returns negative if this
value is less than the other
value, returns zero if they are equal, and returns positive if this
value is greater than the other
value. The vectors need not be the same size (the smaller vector will be temporarily zero extended on its most significant end). An empty vector is treated as zero.
Definition at line 1153 of file BitVector.h.
References Sawyer::Container::BitVectorSupport::compare(), data(), and hull().
|
inline |
Compare bits as signed integers.
Compares range1
from this vector with range2
from the other
vector as signed, two's complement integers and returns a value whose sign indicates the ordering relationship between the two ranges. Returns negative if the range1
value is less than the range2
value, returns zero if they are equal, and returns positive if the range1
value is greater than the range2
value. The ranges must be valid for their respective vectors, and need not be the same size (the smaller range will be temporarily zero extended on its most significant end). An empty range is treated as zero. The other
vector is permitted to refer to this
vector, in which case the ranges are also permitted to overlap.
Definition at line 1166 of file BitVector.h.
References checkRange(), Sawyer::Container::BitVectorSupport::compareSigned(), and data().
|
inline |
Compare bits as signed integers.
Compares range1
and range2
from this vector as signed, two's complement integers and returns a value whose sign indicates the ordering relationship between the two ranges. Returns negative if the range1
value is less than the range2
value, returns zero if they are equal, and returns positive if the range1
value is greater than the range2
value. The ranges must be valid for this vector, and need not be the same size (the smaller range will be temporarily zero extended on its most significant end). An empty range is interpreted as zero. The ranges are permitted to overlap.
Definition at line 1180 of file BitVector.h.
References checkRange(), Sawyer::Container::BitVectorSupport::compareSigned(), and data().
|
inline |
Compare bits as signed integers.
Compares the bits of this vector with the bits of other
as signed, two's complement integers and returns a value whose sign indicates the ordering relationship between the two ranges. Returns negative if this
value is less than the other
value, returns zero if they are equal, and returns positive if this
value is greater than the other
value. The vectors need not be the same size (the smaller vector will be temporarily zero extended on its most significant end). An empty vector is treated as zero.
Definition at line 1193 of file BitVector.h.
References Sawyer::Container::BitVectorSupport::compareSigned(), data(), and hull().
|
inline |
Interpret bits as an unsigned integer.
Returns the bits of the specified range by interpreting them as an unsigned integer. The range must be valid for this vector. If the range contains more than 64 bits then only the low-order 64 bits are considered.
Definition at line 1205 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::toInteger().
|
inline |
Interpret bits as an unsigned integer.
Returns the bits of this vector by interpreting them as an unsigned integer. If this vector contains more than 64 bits then only the low-order 64 bits are considered.
Definition at line 1214 of file BitVector.h.
References data(), hull(), size(), and Sawyer::Container::BitVectorSupport::toInteger().
|
inline |
Interpret bits as a signed integer.
Returns the bits of the specified range by interpreting them as a two's complement signed integer, sign extended to the width of the return value. The range must be valid for this vector. If the range size is one bit then the value zero or one is returned; if the range size is less than 64 bits then the bits are sign extended to a width of 64; if the range is larger than 64 bits then only the low-order 64 bits are returned.
Definition at line 1226 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::toInteger().
|
inline |
Interpret bits as a signed integer.
Returns the bits of the specified range by interpreting them as a two's complement signed integer, sign extended to the width of the return value. The range must be valid for this vector. If the range size is one bit then the value zero or one is returned; if the range size is less than 64 bits then the bits are sign extended to a width of 64; if the range is larger than 64 bits then only the low-order 64 bits are returned.
Definition at line 1237 of file BitVector.h.
References data(), hull(), size(), and Sawyer::Container::BitVectorSupport::toSignedInteger().
|
inline |
Convert to a hexadecimal string.
Returns a string which is the hexadecimal representation of the bits in the specified range. The range must be valid for this vector. No prefix or suffix is added (e.g., no leading "0x" or trailing "h"). The number of digits in the return value is the minimum required to explicitly represent each bit of the range, including leading zeros; an empty range will return an empty string. The returned string is lower case.
Definition at line 1249 of file BitVector.h.
References data(), and Sawyer::Container::BitVectorSupport::toHex().
Referenced by Sawyer::Container::AddressMapConstraints< AddressMap >::print().
|
inline |
Convert to a hexadecimal string.
Returns a string which is the hexadecimal representation of the bits in this vector. No prefix or suffix is added (e.g., no leading "0x" or trailing "h"). The number of digits in the return value is the minimum required to explicitly represent each bit of the vector, including leading zeros; an empty vector will return an empty string. The returned string is lower case.
Definition at line 1259 of file BitVector.h.
References data(), hull(), and Sawyer::Container::BitVectorSupport::toHex().
|
inline |
Convert to an octal string.
Returns a string which is the octal representation of the bits in the specified range. The range must be valid for this vector. No prefix or suffix is added (e.g., no extra leading "0" or trailing "o"). The number of digits in the return value is the minimum required to explicitly represent each bit of the range, including leading zeros; an empty range will return an empty string.
Definition at line 1269 of file BitVector.h.
References data(), and Sawyer::Container::BitVectorSupport::toOctal().
|
inline |
Convert to an octal string.
Returns a string which is the octal representation of the bits in this vector. No prefix or suffix is added (e.g., no leading "0" or trailing "o"). The number of digits in the return value is the minimum required to explicitly represent each bit of the vector, including leading zeros; an empty vector will return an empty string.
Definition at line 1278 of file BitVector.h.
References data(), hull(), and Sawyer::Container::BitVectorSupport::toOctal().
|
inline |
Convert to a binary string.
Returns a string which is the binary representation of the bits in the specified range. The range must be valid for this vector. No prefix or suffix is added (e.g., no extra leading or trailing "b"). The number of digits in the return value is the minimum required to explicitly represent each bit of the range, including leading zeros; an empty range will return an empty string.
Definition at line 1288 of file BitVector.h.
References data(), and Sawyer::Container::BitVectorSupport::toBinary().
|
inline |
Convert to an binary string.
Returns a string which is the binary representation of the bits in this vector. No prefix or suffix is added (e.g., no leading or trailing "b"). The number of digits in the return value is the minimum required to explicitly represent each bit of the vector, including leading zeros; an empty vector will return an empty string.
Definition at line 1297 of file BitVector.h.
References data(), hull(), and Sawyer::Container::BitVectorSupport::toBinary().
|
inline |
Obtain bits from an integer.
Assigns the specified value to the bits indicated by range
of this vector. If the range contains fewer than 64 bits then only the low order bits of value
are used; if the range contains more than 64 bits then the high-order bits are cleared. The range must be a valid range for this vector.
Definition at line 1306 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::fromInteger().
Referenced by Sawyer::Container::AddressMapConstraints< AddressMap >::print().
|
inline |
Obtain bits from an integer.
Assigns the specified value to this vector. If this vector contains fewer than 64 bits then only the low order bits of value
are used; if this vector contains more than 64 bits then the high-order bits are cleared. The size of this vector is not changed by this operation.
Definition at line 1319 of file BitVector.h.
References data(), Sawyer::Container::BitVectorSupport::fromInteger(), and hull().
|
inline |
Obtains bits from a decimal representation.
Assigns the specified value, represented in decimal, to the specified range of this vector. The input
string must contain only valid decimal digits '0' through '9' or the underscore character (to make long strings more readable), or else an std::runtime_error
is thrown. The range must be valid for this vector. If the number of supplied digits is larger than what is required to initialize the specified range then the extra data is discarded. On the other hand, if the length of the string is insufficient to initialize the entire range then the high order bits of the range are cleared.
Definition at line 1333 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::fromDecimal().
Referenced by parse().
|
inline |
Obtain bits from a decimal representation.
Assigns the specified value, represented in decimal, to this vector. The input
string must contain only valid decimal digits '0' through '9' or the underscore character (to make long strings more readable), or else an std::runtime_error
is thrown. If the number of supplied digits is larger than what is required to initialize this vector then the extra data is discarded. On the other hand, if the length of the string is insufficient to initialize the entire vector then the high order bits of the vector are cleared. The size of this vector is not changed by this operation.
Definition at line 1347 of file BitVector.h.
References data(), Sawyer::Container::BitVectorSupport::fromDecimal(), and hull().
|
inline |
Obtain bits from a hexadecimal representation.
Assigns the specified value, represented in hexadecimal, to the specified range of this vector. The input
string must contain only valid hexadecimal digits '0' through '9', 'a' through 'f', and 'A' through 'F', or the underscore character (to make long strings more readable), or else an std::runtime_error
is thrown. The range must be valid for this vector. If the number of supplied digits is larger than what is required to initialize the specified range then the extra data is discarded. On the other hand, if the length of the string is insufficient to initialize the entire range then the high order bits of the range are cleared.
Definition at line 1360 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::fromHex().
Referenced by parse().
|
inline |
Obtain bits from a hexadecimal representation.
Assigns the specified value, represented in hexadecimal, to this vector. The input
string must contain only valid hexadecimal digits '0' through '9', 'a' through 'f', and 'A' through 'F', or the underscore character (to make long strings more readable), or else an std::runtime_error
is thrown. If the number of supplied digits is larger than what is required to initialize this vector then the extra data is discarded. On the other hand, if the length of the string is insufficient to initialize the entire vector then the high order bits of the vector are cleared. The size of this vector is not changed by this operation.
Definition at line 1374 of file BitVector.h.
References data(), Sawyer::Container::BitVectorSupport::fromHex(), and hull().
|
inline |
Obtain bits from an octal representation.
Assigns the specified value, represented in octal, to the specified range of this vector. The input
string must contain only valid octal digits '0' through '7' or the underscore character (to make long strings more readable), or else an std::runtime_error
is thrown. The range must be valid for this vector. If the number of supplied digits is larger than what is required to initialize the specified range then the extra data is discarded. On the other hand, if the length of the string is insufficient to initialize the entire range then the high order bits of the range are cleared.
Definition at line 1387 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::fromOctal().
Referenced by parse().
|
inline |
Obtain bits from an octal representation.
Assigns the specified value, represented in octal, to this vector. The input
string must contain only valid octal digits '0' through '7' or the underscore character (to make long strings more readable), or else an std::runtime_error
is thrown. If the number of supplied digits is larger than what is required to initialize this vector then the extra data is discarded. On the other hand, if the length of the string is insufficient to initialize the entire vector then the high order bits of the vector are cleared. The size of this vector is not changed by this operation.
Definition at line 1401 of file BitVector.h.
References data(), Sawyer::Container::BitVectorSupport::fromOctal(), and hull().
|
inline |
Obtain bits from a binary representation.
Assigns the specified value, represented in binary, to the specified range of this vector. The input
string must contain only valid binary digits '0' and '1' or the underscore character (to make long strings more readable), or else an std::runtime_error
is thrown. The range must be valid for this vector. If the number of supplied digits is larger than what is required to initialize the specified range then the extra data is discarded. On the other hand, if the length of the string is insufficient to initialize the entire range then the high order bits of the range are cleared.
Definition at line 1414 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::fromBinary().
Referenced by parse().
|
inline |
Obtain bits from a binary representation.
Assigns the specified value, represented in binary, to this vector. The input
string must contain only valid binary digits '0' and '1' or the underscore character (to make long strings more readable), or else an std::runtime_error
is thrown. If the number of supplied digits is larger than what is required to initialize this vector then the extra data is discarded. On the other hand, if the length of the string is insufficient to initialize the entire vector then the high order bits of the vector are cleared. The size of this vector is not changed by this operation.
Definition at line 1428 of file BitVector.h.
References data(), Sawyer::Container::BitVectorSupport::fromBinary(), and hull().
|
inline |
Assert valid range.
Asserts that the specified range is valid for this vector. This is intended mostly for internal use and does nothing when assertions are disabled.
Definition at line 1441 of file BitVector.h.
References hull().
Referenced by add(), bitwiseAnd(), bitwiseOr(), bitwiseXor(), clear(), compare(), compareSigned(), copy(), decrement(), equalTo(), fromBinary(), fromDecimal(), fromHex(), fromInteger(), fromOctal(), get(), increment(), invert(), isAllClear(), isAllSet(), isEqualToZero(), leastSignificantClearBit(), leastSignificantDifference(), leastSignificantSetBit(), mostSignificantClearBit(), mostSignificantDifference(), mostSignificantSetBit(), nClear(), negate(), nSet(), rotateLeft(), rotateRight(), set(), setValue(), shiftLeft(), shiftRight(), shiftRightArithmetic(), signExtend(), subtract(), swap(), toInteger(), and toSignedInteger().
|
inline |
Raw data for vector.
Returns a pointer to the raw data for the vector. This is mostly for internal use so that the raw data can be passed to the BitVectorSupport functions.
Definition at line 1451 of file BitVector.h.
Referenced by add(), bitwiseAnd(), bitwiseOr(), bitwiseXor(), clear(), compare(), compareSigned(), copy(), decrement(), equalTo(), fromBinary(), fromDecimal(), fromHex(), fromInteger(), fromOctal(), get(), increment(), invert(), isAllClear(), isAllSet(), isEqualToZero(), leastSignificantClearBit(), leastSignificantDifference(), leastSignificantSetBit(), mostSignificantClearBit(), mostSignificantDifference(), mostSignificantSetBit(), multiply10(), nClear(), negate(), nSet(), resize(), rotateLeft(), rotateRight(), set(), setValue(), shiftLeft(), shiftRight(), shiftRightArithmetic(), signExtend(), subtract(), swap(), toBinary(), toHex(), toInteger(), toOctal(), and toSignedInteger().
|
inline |
Raw data for vector.
Returns a pointer to the raw data for the vector. This is mostly for internal use so that the raw data can be passed to the BitVectorSupport functions.
Definition at line 1455 of file BitVector.h.
|
inline |
Raw data size.
Returns the number of elements of type Word in the array returned by the data method.
Definition at line 1463 of file BitVector.h.