ROSE 0.11.145.147
|
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 69 of file BitVector.h.
#include <Sawyer/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. | |
BitVector & | operator= (const BitVector &other) |
Assignment. | |
bool | isEmpty () const |
Determines if the vector is empty. | |
size_t | size () const |
Size of vector in bits. | |
BitVector & | resize (size_t newSize, bool newBits=false) |
Change vector size. | |
size_t | capacity () const |
Maximum size before reallocation. | |
BitRange | hull () const |
Interval representing the entire vector. | |
bool | get (size_t idx) const |
Retrieve one bit. | |
BitVector & | clear (const BitRange &range) |
Assign zero to some bits. | |
BitVector & | clear () |
Assign zero to all bits. | |
BitVector & | set (const BitRange &range) |
Assign true to some bits. | |
BitVector & | set () |
Assign true to all bits. | |
BitVector & | setValue (const BitRange &range, bool value) |
Assign true/false to some bits. | |
BitVector & | setValue (bool value) |
Assign true/false to all bits. | |
BitVector & | copy (const BitRange &to, const BitVector &other, const BitRange &from) |
Copy some bits. | |
BitVector & | copy (const BitRange &to, const BitRange &from) |
Copy some bits. | |
BitVector & | swap (const BitRange &range1, BitVector &other, const BitRange &range2) |
Swap some bits. | |
BitVector & | swap (const BitRange &range1, const BitRange &range2) |
Swap some bits. | |
bool | equalTo (const BitRange &range1, BitVector &other, const BitRange &range2) const |
Checks whether two ranges are equal. | |
bool | equalTo (const BitRange &range1, const BitRange &range2) const |
Checks whether the bits of two ranges are equal. | |
bool | equalTo (const BitVector &other) const |
Checks whether the bits of one vector are equal to the bits of the other. | |
Optional< size_t > | leastSignificantSetBit (const BitRange &range) const |
Find the least significant set bit. | |
Optional< size_t > | leastSignificantSetBit () const |
Find the least significant set bit. | |
Optional< size_t > | leastSignificantClearBit (const BitRange &range) const |
Find the least significant clear bit. | |
Optional< size_t > | leastSignificantClearBit () const |
Find the least significant clear bit. | |
Optional< size_t > | mostSignificantSetBit (const BitRange &range) const |
Find the most significant set bit. | |
Optional< size_t > | mostSignificantSetBit () const |
Find the most significant set bit. | |
Optional< size_t > | mostSignificantClearBit (const BitRange &range) const |
Find the most significant clear bit. | |
Optional< size_t > | mostSignificantClearBit () const |
Find the most significant clear bit. | |
bool | isAllSet (const BitRange &range) const |
True if all bits are set. | |
bool | isAllSet () const |
True if all bits are set. | |
bool | isAllClear (const BitRange &range) const |
True if all bits are clear. | |
bool | isAllClear () const |
True if all bits are clear. | |
size_t | nSet (const BitRange &range) const |
Number of set bits. | |
size_t | nSet () const |
Number of set bits. | |
size_t | nClear (const BitRange &range) const |
Number of clear bits. | |
size_t | nClear () const |
Number of clear bits. | |
Optional< size_t > | mostSignificantDifference (const BitRange &range1, const BitVector &other, const BitRange &range2) const |
Find most significant difference. | |
Optional< size_t > | mostSignificantDifference (const BitRange &range1, const BitRange &range2) const |
Find most significant difference. | |
Optional< size_t > | mostSignificantDifference (const BitVector &other) const |
Find most significant difference. | |
Optional< size_t > | leastSignificantDifference (const BitRange &range1, const BitVector &other, const BitRange &range2) const |
Find least significant difference. | |
Optional< size_t > | leastSignificantDifference (const BitRange &range1, const BitRange &range2) const |
Find least significant difference. | |
Optional< size_t > | leastSignificantDifference (const BitVector &other) const |
Find least significant difference. | |
BitVector & | shiftLeft (const BitRange &range, size_t nShift, bool newBits=0) |
Shift bits left. | |
BitVector & | shiftLeft (size_t nShift, bool newBits=0) |
Shift bits left. | |
BitVector & | shiftRight (const BitRange &range, size_t nShift, bool newBits=0) |
Shift bits right. | |
BitVector & | shiftRight (size_t nShift, bool newBits=0) |
Shift bits right. | |
BitVector & | shiftRightArithmetic (const BitRange &range, size_t nShift) |
Shift bits right. | |
BitVector & | shiftRightArithmetic (size_t nShift) |
Shift bits right. | |
BitVector & | rotateRight (const BitRange &range, size_t nShift) |
Rotate bits right. | |
BitVector & | rotateRight (size_t nShift) |
Rotate bits right. | |
BitVector & | rotateLeft (const BitRange &range, size_t nShift) |
Rotate bits left. | |
BitVector & | rotateLeft (size_t nShift) |
Rotate bits left. | |
BitVector & | negate (const BitRange &range1) |
Negates bits as integer. | |
BitVector & | negate () |
Negates bits as integer. | |
bool | increment (const BitRange &range1) |
Increment bits as integer. | |
bool | increment () |
Increment bits as integer. | |
bool | decrement (const BitRange &range1) |
Decrement bits as integer. | |
bool | decrement () |
Decrement bits as integer. | |
bool | add (const BitRange &range1, const BitVector &other, const BitRange &range2) |
Add bits as integers. | |
bool | add (const BitRange &range1, const BitRange &range2) |
Add bits as integers. | |
bool | add (const BitVector &other) |
Add bits as integers. | |
bool | subtract (const BitRange &range1, const BitVector &other, const BitRange &range2) |
Subtract bits as integers. | |
bool | subtract (const BitRange &range1, const BitRange &range2) |
Subtract bits as integers. | |
bool | subtract (const BitVector &other) |
Subtract bits as integers. | |
BitVector & | signExtend (const BitRange &range1, const BitVector &other, const BitRange &range2) |
Copy bits and sign extend. | |
BitVector & | signExtend (const BitRange &range1, const BitRange &range2) |
Copy bits and sign extend. | |
BitVector & | signExtend (const BitVector &other) |
Copy bits and sign extend. | |
BitVector & | multiply10 () |
Multiply by 10. | |
BitVector & | multiply10 (const BitRange &range) |
Multiply by 10. | |
BitVector | multiply (const BitVector &other) const |
Multiply two bit vectors. | |
BitVector | multiplySigned (const BitVector &other) const |
Multiply two signed integers. | |
BitVector & | invert (const BitRange &range) |
Invert bits. | |
BitVector & | invert () |
Invert bits. | |
BitVector & | bitwiseAnd (const BitRange &range1, const BitVector &other, const BitRange &range2) |
Bit-wise AND. | |
BitVector & | bitwiseAnd (const BitRange &range1, const BitRange &range2) |
Bit-wise AND. | |
BitVector & | bitwiseAnd (const BitVector &other) |
Bit-wise AND. | |
BitVector & | bitwiseOr (const BitRange &range1, const BitVector &other, const BitRange &range2) |
Bit-wise OR. | |
BitVector & | bitwiseOr (const BitRange &range1, const BitRange &range2) |
Bit-wise OR. | |
BitVector & | bitwiseOr (const BitVector &other) |
Bit-wise OR. | |
BitVector & | bitwiseXor (const BitRange &range1, const BitVector &other, const BitRange &range2) |
Bit-wise XOR. | |
BitVector & | bitwiseXor (const BitRange &range1, const BitRange &range2) |
Bit-wise XOR. | |
BitVector & | bitwiseXor (const BitVector &other) |
Bit-wise XOR. | |
bool | isEqualToZero (const BitRange &range) const |
Compare to zero. | |
bool | isEqualToZero () const |
Compare to zero. | |
int | compare (const BitRange &range1, const BitVector &other, const BitRange &range2) const |
Compare bits as integers. | |
int | compare (const BitRange &range1, const BitRange &range2) const |
Compare bits as integers. | |
int | compare (const BitVector &other) const |
Compare bits as integers. | |
int | compareSigned (const BitRange &range1, const BitVector &other, const BitRange &range2) const |
Compare bits as signed integers. | |
int | compareSigned (const BitRange &range1, const BitRange &range2) const |
Compare bits as signed integers. | |
int | compareSigned (const BitVector &other) const |
Compare bits as signed integers. | |
boost::uint64_t | toInteger (const BitRange &range) const |
Interpret bits as an unsigned integer. | |
boost::uint64_t | toInteger () const |
Interpret bits as an unsigned integer. | |
boost::int64_t | toSignedInteger (const BitRange &range) const |
Interpret bits as a signed integer. | |
boost::int64_t | toSignedInteger () const |
Interpret bits as a signed integer. | |
std::string | toHex (const BitRange &range) const |
Convert to a hexadecimal string. | |
std::string | toHex () const |
Convert to a hexadecimal string. | |
std::string | toOctal (const BitRange &range) const |
Convert to an octal string. | |
std::string | toOctal () const |
Convert to an octal string. | |
std::string | toBinary (const BitRange &range) const |
Convert to a binary string. | |
std::string | toBinary () const |
Convert to an binary string. | |
BitVector & | fromInteger (const BitRange &range, boost::uint64_t value) |
Obtain bits from an integer. | |
BitVector & | fromInteger (boost::uint64_t value) |
Obtain bits from an integer. | |
BitVector & | fromDecimal (const BitRange &range, const std::string &input) |
Obtains bits from a decimal representation. | |
BitVector & | fromDecimal (const std::string &input) |
Obtain bits from a decimal representation. | |
BitVector & | fromHex (const BitRange &range, const std::string &input) |
Obtain bits from a hexadecimal representation. | |
BitVector & | fromHex (const std::string &input) |
Obtain bits from a hexadecimal representation. | |
BitVector & | fromOctal (const BitRange &range, const std::string &input) |
Obtain bits from an octal representation. | |
BitVector & | fromOctal (const std::string &input) |
Obtain bits from an octal representation. | |
BitVector & | fromBinary (const BitRange &range, const std::string &input) |
Obtain bits from a binary representation. | |
BitVector & | fromBinary (const std::string &input) |
Obtain bits from a binary representation. | |
void | checkRange (const BitRange &range) const |
Assert valid range. | |
size_t | dataSize () const |
Raw data size. | |
std::vector< uint8_t > | toBytes () const |
Convert to a vector of bytes. | |
std::vector< uint8_t > | toBytes (const BitRange &range) const |
Convert to a vector of bytes. | |
BitVector & | fromBytes (const std::vector< uint8_t > &input) |
Obtain bits from a byte vector. | |
BitVector & | fromBytes (const BitRange &range, const std::vector< uint8_t > &input) |
Obtain bits from a byte vector. | |
Word * | data () |
Raw data for vector. | |
const Word * | data () const |
Raw data for vector. | |
Static Public Member Functions | |
static BitVector | parse (std::string str) |
Create a bit vector by reading a string. | |
static BitRange | baseSize (size_t base, size_t size) |
Create a bit range from a starting offset and size. | |
static BitRange | hull (size_t minOffset, size_t maxOffset) |
Create a bit range from min and max positions. | |
typedef unsigned Sawyer::Container::BitVector::Word |
Base storage type.
Definition at line 71 of file BitVector.h.
Describes an inclusive interval of bit indices.
Definition at line 72 of file BitVector.h.
|
inline |
Default construct an empty vector.
Definition at line 102 of file BitVector.h.
|
inline |
Copy constructor.
Definition at line 105 of file BitVector.h.
|
inlineexplicit |
Create a vector of specified size.
All bits in this vector will be set to the newBits
value.
Definition at line 110 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 125 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 194 of file BitVector.h.
|
inline |
Determines if the vector is empty.
Returns true if this vector contains no data.
Definition at line 203 of file BitVector.h.
Referenced by Rose::BinaryAnalysis::SymbolicExpression::Leaf::isConstant().
|
inline |
Size of vector in bits.
Returns the size of this vector in bits.
Definition at line 208 of file BitVector.h.
Referenced by Rose::BinaryAnalysis::SymbolicExpressionParser::Token::Token(), 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 215 of file BitVector.h.
References clear(), 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 236 of file BitVector.h.
|
inline |
Interval representing the entire vector.
Returns the smallest index interval that includes all bits.
Definition at line 243 of file BitVector.h.
References Sawyer::Container::Interval< size_t >::hull().
Referenced by add(), bitwiseAnd(), bitwiseOr(), bitwiseXor(), checkRange(), clear(), compare(), compareSigned(), decrement(), equalTo(), fromBinary(), fromBytes(), 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(), toBytes(), 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 251 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 259 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 271 of file BitVector.h.
References checkRange(), data(), and Sawyer::Container::BitVectorSupport::get().
Referenced by Sawyer::Container::Algorithm::GraphTraversal< G, Order, Direction >::isDiscovered(), Sawyer::Container::Algorithm::GraphTraversal< G, Order, Direction >::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 281 of file BitVector.h.
References checkRange(), Sawyer::Container::BitVectorSupport::clear(), and data().
Referenced by resize().
|
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 292 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 301 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 311 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 319 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 328 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 340 of file BitVector.h.
References checkRange(), Sawyer::Container::BitVectorSupport::copy(), and data().
|
inline |
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 352 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 364 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 375 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 385 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 395 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 405 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 420 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 429 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 438 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 447 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 456 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 465 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 474 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 483 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 491 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 499 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 509 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 519 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 526 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 534 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 541 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 549 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 563 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 578 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 589 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 603 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 618 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 629 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 644 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 657 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 669 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 682 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 695 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 709 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 719 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 730 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 740 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 751 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 764 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 774 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 784 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 793 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 802 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 811 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 821 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 832 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 844 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 857 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 871 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 882 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 892 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 904 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 915 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 924 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 933 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 942 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 958 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 1004 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 1013 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 1023 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 1034 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 1045 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 1055 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 1066 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 1077 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 1087 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 1098 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 1109 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 1124 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 1134 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 1146 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 1159 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 1172 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 1185 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 1199 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 1212 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 1224 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 1233 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 1245 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 1256 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 1268 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 1278 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 1288 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 1297 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 1307 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 1316 of file BitVector.h.
References data(), hull(), and Sawyer::Container::BitVectorSupport::toBinary().
|
inline |
Convert to a vector of bytes.
The returned vector is in little endian order. The size of the returned vector is rounded up to the next whole byte and any extra bits in the return value are cleared. For instance, if this bit vector contains 13 bits, then the return value will be two bytes with the highest order three bits of the second byte cleared.
Definition at line 1327 of file BitVector.h.
|
inline |
Convert to a vector of bytes.
The returned vector is in little endian order. The size of the returned vector is rounded up to the next whole byte and any extra bits in the return value are cleared. For instance, if this bit vector contains 13 bits, then the return value will be two bytes with the highest order three bits of the second byte cleared.
Definition at line 1330 of file BitVector.h.
References data().
|
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 1340 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 1353 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 1367 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 1381 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 1394 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 1408 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 1421 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 1435 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 1448 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 1462 of file BitVector.h.
References data(), Sawyer::Container::BitVectorSupport::fromBinary(), and hull().
|
inline |
Obtain bits from a byte vector.
Reads bits from the little-endian byte vector and copies them into the specified range of this bit vector. If no range is specified, then this entire bit vector is initialized. The byte vector must be long enough to initialize the specified range or the whole bit vector.
Definition at line 1474 of file BitVector.h.
|
inline |
Obtain bits from a byte vector.
Reads bits from the little-endian byte vector and copies them into the specified range of this bit vector. If no range is specified, then this entire bit vector is initialized. The byte vector must be long enough to initialize the specified range or the whole bit vector.
Definition at line 1478 of file BitVector.h.
References data().
|
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 1492 of file BitVector.h.
References hull().
Referenced by add(), add(), bitwiseAnd(), bitwiseAnd(), bitwiseOr(), bitwiseOr(), bitwiseXor(), bitwiseXor(), clear(), compare(), compare(), compareSigned(), compareSigned(), copy(), copy(), decrement(), equalTo(), equalTo(), fromBinary(), fromDecimal(), fromHex(), fromInteger(), fromOctal(), get(), increment(), invert(), isAllClear(), isAllSet(), isEqualToZero(), leastSignificantClearBit(), leastSignificantDifference(), leastSignificantDifference(), leastSignificantSetBit(), mostSignificantClearBit(), mostSignificantDifference(), mostSignificantDifference(), mostSignificantSetBit(), nClear(), negate(), nSet(), rotateLeft(), rotateRight(), set(), setValue(), shiftLeft(), shiftRight(), shiftRightArithmetic(), signExtend(), signExtend(), subtract(), subtract(), swap(), 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 1502 of file BitVector.h.
Referenced by add(), add(), add(), bitwiseAnd(), bitwiseAnd(), bitwiseAnd(), bitwiseOr(), bitwiseOr(), bitwiseOr(), bitwiseXor(), bitwiseXor(), bitwiseXor(), clear(), clear(), compare(), compare(), compare(), compareSigned(), compareSigned(), compareSigned(), copy(), copy(), decrement(), decrement(), equalTo(), equalTo(), equalTo(), fromBinary(), fromBinary(), fromBytes(), fromBytes(), fromDecimal(), fromDecimal(), fromHex(), fromHex(), fromInteger(), fromInteger(), fromOctal(), fromOctal(), get(), increment(), increment(), invert(), invert(), isAllClear(), isAllClear(), isAllSet(), isAllSet(), isEqualToZero(), isEqualToZero(), leastSignificantClearBit(), leastSignificantClearBit(), leastSignificantDifference(), leastSignificantDifference(), leastSignificantDifference(), leastSignificantSetBit(), leastSignificantSetBit(), mostSignificantClearBit(), mostSignificantClearBit(), mostSignificantDifference(), mostSignificantDifference(), mostSignificantDifference(), mostSignificantSetBit(), mostSignificantSetBit(), multiply10(), multiply10(), nClear(), nClear(), negate(), negate(), nSet(), nSet(), resize(), rotateLeft(), rotateLeft(), rotateRight(), rotateRight(), set(), set(), setValue(), setValue(), shiftLeft(), shiftLeft(), shiftRight(), shiftRight(), shiftRightArithmetic(), shiftRightArithmetic(), signExtend(), signExtend(), signExtend(), subtract(), subtract(), subtract(), swap(), swap(), toBinary(), toBinary(), toBytes(), toBytes(), toHex(), toHex(), toInteger(), toInteger(), toOctal(), toOctal(), toSignedInteger(), 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 1506 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 1514 of file BitVector.h.