llvm::APFloat::rmNearestTiesToEven, &ignore);
}
Scalar(llvm::APInt v)
- : m_type(GetBestTypeForBitSize(v.getBitWidth(), true)),
- m_integer(std::move(v)), m_float(0.0f) {}
-
- /// Return the most efficient Scalar::Type for the requested bit size.
- static Type GetBestTypeForBitSize(size_t bit_size, bool sign);
+ : m_type(e_sint), m_integer(std::move(v)), m_float(0.0f) {}
bool SignExtend(uint32_t bit_pos);
static const char *GetValueTypeAsCString(Scalar::Type value_type);
- static Scalar::Type
- GetValueTypeForSignedIntegerWithByteSize(size_t byte_size);
-
- static Scalar::Type
- GetValueTypeForUnsignedIntegerWithByteSize(size_t byte_size);
-
// All operators can benefits from the implicit conversions that will happen
// automagically by the compiler, so no temporary objects will need to be
// created. As a result, we currently don't need a variety of overloaded set
}
}
-Scalar::Type Scalar::GetBestTypeForBitSize(size_t bit_size, bool sign) {
- return sign ? e_sint : e_uint;
-}
-
void Scalar::TruncOrExtendTo(uint16_t bits, bool sign) {
m_integer = sign ? m_integer.sextOrTrunc(bits) : m_integer.zextOrTrunc(bits);
- m_type = GetBestTypeForBitSize(bits, sign);
+ m_type = sign ? e_sint : e_uint;
}
bool Scalar::IntegralPromote(uint16_t bits, bool sign) {
return "???";
}
-Scalar::Type
-Scalar::GetValueTypeForSignedIntegerWithByteSize(size_t byte_size) {
- return e_sint;
-}
-
-Scalar::Type
-Scalar::GetValueTypeForUnsignedIntegerWithByteSize(size_t byte_size) {
- return e_uint;
-}
-
bool Scalar::MakeSigned() {
bool success = false;
case lldb::eEncodingSint: {
if (data.GetByteSize() < byte_size)
return Status("insufficient data");
- Type type = GetBestTypeForBitSize(byte_size*8, encoding == lldb::eEncodingSint);
- if (type == e_void) {
- return Status("unsupported integer byte size: %" PRIu64 "",
- static_cast<uint64_t>(byte_size));
- }
- m_type = type;
+ m_type = encoding == lldb::eEncodingSint ? e_sint : e_uint;
if (data.GetByteOrder() == endian::InlHostByteOrder()) {
m_integer = APInt::getNullValue(8 * byte_size);
llvm::LoadIntFromMemory(m_integer, data.GetDataStart(), byte_size);