Changeset View
Changeset View
Standalone View
Standalone View
lldb/trunk/source/Core/DataExtractor.cpp
//===-- DataExtractor.cpp ---------------------------------------*- C++ -*-===// | //===-- DataExtractor.cpp ---------------------------------------*- C++ -*-===// | ||||
// | // | ||||
// The LLVM Compiler Infrastructure | // The LLVM Compiler Infrastructure | ||||
// | // | ||||
// This file is distributed under the University of Illinois Open Source | // This file is distributed under the University of Illinois Open Source | ||||
// License. See LICENSE.TXT for details. | // License. See LICENSE.TXT for details. | ||||
// | // | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
#include <assert.h> | #include <assert.h> | ||||
#include <stddef.h> | #include <stddef.h> | ||||
#include <bitset> | #include <bitset> | ||||
#include <limits> | #include <limits> | ||||
#include <sstream> | #include <sstream> | ||||
#include <string> | #include <string> | ||||
#include <math.h> | |||||
#include "clang/AST/ASTContext.h" | #include "clang/AST/ASTContext.h" | ||||
#include "llvm/ADT/APFloat.h" | #include "llvm/ADT/APFloat.h" | ||||
#include "llvm/ADT/APInt.h" | #include "llvm/ADT/APInt.h" | ||||
#include "llvm/ADT/ArrayRef.h" | #include "llvm/ADT/ArrayRef.h" | ||||
#include "llvm/ADT/SmallVector.h" | #include "llvm/ADT/SmallVector.h" | ||||
#include "llvm/Support/MathExtras.h" | #include "llvm/Support/MathExtras.h" | ||||
▲ Show 20 Lines • Show All 1,375 Lines • ▼ Show 20 Lines | if (GetAPInt (data, &offset, byte_size, apint)) | ||||
case 10: | case 10: | ||||
break; | break; | ||||
} | } | ||||
s->Write(apint_str.c_str(), apint_str.size()); | s->Write(apint_str.c_str(), apint_str.size()); | ||||
} | } | ||||
return offset; | return offset; | ||||
} | } | ||||
static float half2float (uint16_t half) | static float | ||||
half2float (uint16_t half) | |||||
{ | { | ||||
#ifdef _MSC_VER | |||||
llvm_unreachable("half2float not implemented for MSVC"); | |||||
#else | |||||
union{ float f; uint32_t u;}u; | union { float f; uint32_t u; } u; | ||||
int32_t v = (int16_t) half; | int32_t v = (int16_t) half; | ||||
if( 0 == (v & 0x7c00)) | if (0 == (v & 0x7c00)) | ||||
{ | { | ||||
u.u = v & 0x80007FFFU; | u.u = v & 0x80007FFFU; | ||||
return u.f * ldexpf(1, 125); | return u.f * ldexpf(1, 125); | ||||
} | } | ||||
v <<= 13; | v <<= 13; | ||||
u.u = v | 0x70000000U; | u.u = v | 0x70000000U; | ||||
return u.f * ldexpf(1, -112); | return u.f * ldexpf(1, -112); | ||||
#endif | |||||
} | } | ||||
lldb::offset_t | lldb::offset_t | ||||
DataExtractor::Dump (Stream *s, | DataExtractor::Dump (Stream *s, | ||||
offset_t start_offset, | offset_t start_offset, | ||||
lldb::Format item_format, | lldb::Format item_format, | ||||
size_t item_byte_size, | size_t item_byte_size, | ||||
size_t item_count, | size_t item_count, | ||||
▲ Show 20 Lines • Show All 852 Lines • Show Last 20 Lines |