GT-3170 Additional refinements to handling of BooleanDataType and

AbstractIntegerDataType
This commit is contained in:
ghidra1 2019-09-20 10:31:30 -04:00
parent 9d2ab478c0
commit 38dd0c177f
8 changed files with 25 additions and 15 deletions

View file

@ -323,9 +323,6 @@ class DataDB extends CodeUnitDB implements Data {
if (obj instanceof Scalar) {
return (Scalar) obj;
}
else if (obj instanceof Boolean) {
return new Scalar(getLength() * 8, ((Boolean) obj).booleanValue() ? 1 : 0);
}
else if (obj instanceof Address) {
Address addrObj = (Address) obj;
long offset = addrObj.getAddressableWordOffset();

View file

@ -103,8 +103,7 @@ public class BooleanDataType extends AbstractIntegerDataType {
@Override
public String getRepresentation(BigInteger bigInt, Settings settings, int bitLength) {
return bigInt.testBit(0) ? "TRUE" : "FALSE";
return BigInteger.ZERO.equals(bigInt) ? "FALSE" : "TRUE";
}
@Override

View file

@ -40,8 +40,8 @@ public class HighConstant extends HighVariable {
* @param func the associated high function
* @throws InvalidInputException
*/
public HighConstant(String name, DataType type, Varnode vn, Address pc,
HighFunction func) throws InvalidInputException {
public HighConstant(String name, DataType type, Varnode vn, Address pc, HighFunction func)
throws InvalidInputException {
super(name, type, vn, null, func);
pcaddr = pc;
}
@ -55,8 +55,8 @@ public class HighConstant extends HighVariable {
* @param sym associated dynamic symbol
* @throws InvalidInputException
*/
public HighConstant(String name, DataType type, Varnode vn, Address pc,
DynamicSymbol sym) throws InvalidInputException {
public HighConstant(String name, DataType type, Varnode vn, Address pc, DynamicSymbol sym)
throws InvalidInputException {
this(name, type, vn, pc, sym.getHighFunction());
symbol = sym;
}
@ -76,7 +76,7 @@ public class HighConstant extends HighVariable {
}
/**
* Returns constant as a scalar object
* @return constant as a scalar object
*/
public Scalar getScalar() {
boolean signed = false;