|
decompiler 1.0.0
|
An endian aware range of bits contained in a contiguous set of bytes. More...
#include <address.hh>
Public Member Functions | |
| BitRange (void) | |
| Construct undefined range. | |
| BitRange (int4 bOff, int4 bSize, bool bigEndian) | |
| Construct byte range. | |
| BitRange (const BitRange &op2, int4 off, int4 sz) | |
| Constructor, copy range into new container. | |
| BitRange (int4 bOff, int4 bSize, int4 least, int4 num, bool bigEndian) | |
| Constructor. | |
| bool | empty (void) const |
| Return true if this is an empty bit range (zero bits) | |
| int4 | compare (const BitRange &op2) const |
| Compare this with another as containers. | |
| int4 | translateLSB (const BitRange &op2) const |
| Translate the leastSigBit of the given range into this reference frame. | |
| int4 | overlapTest (const BitRange &op2) const |
| Characterize the type of overlap between this and another range. | |
| void | intersection (const BitRange &op2) |
| Replace this with the intersection of this with another BitRange. | |
| void | intersectMask (uintb mask) |
| Restrict this with a mask that lines up with the container. | |
| void | shift (int4 leftShiftAmount) |
| Replace this with the shifted range. | |
| void | truncateMostSigBytes (int4 num) |
| Truncate the most significant bytes in the byte container. | |
| void | truncateLeastSigBytes (int4 num) |
| Truncate the least significant bytes in the byte container. | |
| void | extendBytes (int4 num) |
| Add most significant bytes to the container. | |
| uintb | getMask (void) const |
| Get mask representing this range. | |
| bool | isByteRange (void) const |
| Return true if this bit range is also a byte range. | |
| bool | isMostSignificant (void) const |
| Return true if the bit range occupies the most significant bits of the container. | |
| void | minimizeContainer (void) |
| Shrink the container to fit the bit range. | |
| void | expandToMost (void) |
| Expand the bitrange until it includes the most significant bits of the container. | |
An endian aware range of bits contained in a contiguous set of bytes.
| int4 ghidra::BitRange::compare | ( | const BitRange & | op2 | ) | const |
Compare this with another as containers.
Both the byte container and the bit range are compared and must be equal to return 0.
| op2 | is the other bit range to compare with |
References byteOffset, byteSize, leastSigBit, and numBits.
Referenced by ghidra::TypeBitField::compare(), and ghidra::TypeBitField::compareDependency().
| void ghidra::BitRange::extendBytes | ( | int4 | num | ) |
Add most significant bytes to the container.
Only the container is affected, the bit range itself does not change.
| num | is the number of bytes to add |
References byteOffset, byteSize, and isBigEndian.
Referenced by ghidra::BitFieldTransform::findOverwrite(), and ghidra::BitFieldInsertTransform::handleSubpieceBack().
| uintb ghidra::BitRange::getMask | ( | void | ) | const |
Get mask representing this range.
The bit-mask is aligned with the byte container.
References leastSigBit, and numBits.
Referenced by ghidra::BitFieldInsertTransform::addConstantWrite(), ghidra::BitFieldInsertTransform::handleAddBack(), ghidra::BitFieldInsertTransform::handleAndBack(), ghidra::BitFieldPullTransform::handleAndForward(), ghidra::BitFieldPullTransform::handleEqualForward(), ghidra::BitFieldInsertTransform::handleOrBack(), intersectMask(), and ghidra::BitFieldPullTransform::testConsumed().
| void ghidra::BitRange::intersection | ( | const BitRange & | op2 | ) |
Replace this with the intersection of this with another BitRange.
The byte container for this does not change only leastSigBit and numBits. If the intersection is empty, numBits is set to 0.
| op2 | is the bit range to intersect with this. |
References leastSigBit, numBits, and translateLSB().
| void ghidra::BitRange::intersectMask | ( | uintb | mask | ) |
Restrict this with a mask that lines up with the container.
The range of bits is intersected with the 1-bits of the mask. The resulting range is the minimal cover of the bits in the intersection.
| mask | is the mask to intersect with |
References getMask(), leastSigBit, and numBits.
Referenced by ghidra::BitFieldTransform::findOverwrite(), ghidra::BitFieldInsertTransform::handleAndBack(), and ghidra::BitFieldInsertTransform::processBackward().
| bool ghidra::BitRange::isByteRange | ( | void | ) | const |
Return true if this bit range is also a byte range.
References leastSigBit, and numBits.
Referenced by ghidra::TypeStruct::decodeBitField().
| bool ghidra::BitRange::isMostSignificant | ( | void | ) | const |
Return true if the bit range occupies the most significant bits of the container.
References byteSize, leastSigBit, and numBits.
Referenced by ghidra::BitFieldNodeState::BitFieldNodeState(), ghidra::BitFieldPullTransform::handleAndForward(), ghidra::BitFieldPullTransform::handleLeftForward(), ghidra::BitFieldPullTransform::handleLessForward(), and ghidra::BitFieldPullTransform::handleMultForward().
| int4 ghidra::BitRange::overlapTest | ( | const BitRange & | op2 | ) | const |
Characterize the type of overlap between this and another range.
Return:
| op2 | is the other range to compare |
this contained in op2
op2 contained in this
References isBigEndian, leastSigBit, numBits, and translateLSB().
Referenced by ghidra::TypeStruct::collectBitFields(), ghidra::BitFieldTransform::establishFields(), ghidra::TypeStruct::findMatchingBitField(), and ghidra::TypeStruct::hasBitFieldsInRange().
| void ghidra::BitRange::shift | ( | int4 | leftShiftAmount | ) |
Replace this with the shifted range.
The bit range is shifted to the left by the given amount.
| leftShiftAmount | is the amount to shift the range by |
References byteSize, leastSigBit, and numBits.
Referenced by ghidra::BitFieldTransform::findOverwrite(), ghidra::BitFieldInsertTransform::handleLeftBack(), ghidra::BitFieldPullTransform::handleLeftForward(), ghidra::BitFieldInsertTransform::handleMultBack(), ghidra::BitFieldPullTransform::handleMultForward(), ghidra::BitFieldInsertTransform::handleRightBack(), ghidra::BitFieldPullTransform::handleRightForward(), and ghidra::BitFieldInsertTransform::handleSubpieceBack().
| int4 ghidra::BitRange::translateLSB | ( | const BitRange & | op2 | ) | const |
Translate the leastSigBit of the given range into this reference frame.
The returned result is directly comparable with leastSigBit for determining order/overlap.
| op2 | is the other BitRange to translate into this frame |
References byteOffset, byteSize, isBigEndian, and leastSigBit.
Referenced by BitRange(), ghidra::BitFieldTransform::establishFields(), intersection(), and overlapTest().
| void ghidra::BitRange::truncateLeastSigBytes | ( | int4 | num | ) |
Truncate the least significant bytes in the byte container.
| num | is the number of bytes to truncate |
References byteOffset, byteSize, isBigEndian, leastSigBit, and numBits.
Referenced by ghidra::BitFieldPullTransform::handleSubpieceForward().
| void ghidra::BitRange::truncateMostSigBytes | ( | int4 | num | ) |
Truncate the most significant bytes in the byte container.
The number of bits may be affected.
| num | is the number of bytes to truncate |
References byteOffset, byteSize, isBigEndian, leastSigBit, and numBits.
Referenced by ghidra::BitFieldPullTransform::handleSubpieceForward(), and ghidra::BitFieldInsertTransform::handleZextBack().