diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-09-06 14:32:30 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-09-06 14:32:30 +0000 |
commit | 027f1c9655391dcb2b0117f931f720211ac933db (patch) | |
tree | 94980f450aa3daec3e1fec217374704ad62cfe45 /source/Core/DataExtractor.cpp | |
parent | 5e95aa85bb660d45e9905ef1d7180b2678280660 (diff) |
Notes
Diffstat (limited to 'source/Core/DataExtractor.cpp')
-rw-r--r-- | source/Core/DataExtractor.cpp | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/source/Core/DataExtractor.cpp b/source/Core/DataExtractor.cpp index b4b43ed97780..861bece98da9 100644 --- a/source/Core/DataExtractor.cpp +++ b/source/Core/DataExtractor.cpp @@ -1830,26 +1830,14 @@ DataExtractor::Dump (Stream *s, } else if (item_bit_size == ast->getTypeSize(ast->LongDoubleTy)) { + const auto &semantics = ast->getFloatTypeSemantics(ast->LongDoubleTy); + const auto byte_size = (llvm::APFloat::getSizeInBits(semantics) + 7) / 8; + llvm::APInt apint; - switch (target_sp->GetArchitecture().GetMachine()) + if (GetAPInt(*this, &offset, byte_size, apint)) { - case llvm::Triple::x86: - case llvm::Triple::x86_64: - // clang will assert when constructing the apfloat if we use a 16 byte integer value - if (GetAPInt (*this, &offset, 10, apint)) - { - llvm::APFloat apfloat (ast->getFloatTypeSemantics(ast->LongDoubleTy), apint); - apfloat.toString(sv, format_precision, format_max_padding); - } - break; - - default: - if (GetAPInt (*this, &offset, item_byte_size, apint)) - { - llvm::APFloat apfloat (ast->getFloatTypeSemantics(ast->LongDoubleTy), apint); - apfloat.toString(sv, format_precision, format_max_padding); - } - break; + llvm::APFloat apfloat(semantics, apint); + apfloat.toString(sv, format_precision, format_max_padding); } } else if (item_bit_size == ast->getTypeSize(ast->HalfTy)) |