BitFields - additional refinements

This commit is contained in:
ghidra1 2019-07-03 11:17:56 -04:00
parent 286d2a6258
commit 3f1ffb276f
4 changed files with 124 additions and 39 deletions

View file

@ -377,13 +377,16 @@ class StructureDB extends CompositeDB implements Structure {
int endIndex = startIndex;
if (startIndex < components.size()) {
// some shifting of components may be required
int endBitOffset = startBitOffset + effectiveBitSize - 1;
endIndex = Collections.binarySearch(components, new Integer(endBitOffset),
int endBitOffset = startBitOffset;
if (effectiveBitSize != 0) {
endBitOffset += effectiveBitSize - 1;
}
endIndex = Collections.binarySearch(components, Integer.valueOf(endBitOffset),
bitOffsetComparator);
if (endIndex < 0) {
endIndex = -endIndex - 1;
}
else {
else if (effectiveBitSize != 0) {
hasConflict = true;
}
}

View file

@ -574,13 +574,16 @@ public class StructureDataType extends CompositeDataTypeImpl implements Structur
int endIndex = startIndex;
if (startIndex < components.size()) {
// some shifting of components may be required
int endBitOffset = startBitOffset + effectiveBitSize - 1;
endIndex = Collections.binarySearch(components, new Integer(endBitOffset),
int endBitOffset = startBitOffset;
if (effectiveBitSize != 0) {
endBitOffset += effectiveBitSize - 1;
}
endIndex = Collections.binarySearch(components, Integer.valueOf(endBitOffset),
bitOffsetComparator);
if (endIndex < 0) {
endIndex = -endIndex - 1;
}
else {
else if (effectiveBitSize != 0) {
hasConflict = true;
}
}