[Lldb-commits] [lldb] r183716 - <rdar://problem/12783351>
Greg Clayton
gclayton at apple.com
Tue Jun 11 10:22:22 PDT 2013
On Jun 10, 2013, at 8:48 PM, Chris Lattner <clattner at apple.com> wrote:
>
> On Jun 10, 2013, at 5:18 PM, Enrico Granata <egranata at apple.com> wrote:
>
>> +++ lldb/trunk/source/Core/DataExtractor.cpp Mon Jun 10 19:18:18 2013
>> @@ -1302,6 +1302,22 @@ DumpAPInt (Stream *s, const DataExtracto
>> return offset;
>> }
>>
>> +static float half2float (uint16_t half)
>> +{
>> + union{ float f; uint32_t u;}u;
>> + int32_t v = (int16_t) half;
>> +
>> + if( 0 == (v & 0x7c00))
>> + {
>> + u.u = v & 0x80007FFFU;
>> + return u.f * 0x1.0p125f;
>> + }
>> +
>> + v <<= 13;
>> + u.u = v | 0x70000000U;
>> + return u.f * 0x1.0p-112f;
>> +}
>> +
>
> Hi Enrico,
>
> Where did you get this algorithm? Did you consider using llvm::APFloat to do this for you?
The reason we didn't use lldb::APFloat when we first created the code was that it didn't support emitting human readable strings, it only emitted the hex compiler string format. We should switch _all_ float display over to using llvm::APFloat now that the class supports emitting human readable strings (at least I think it does).
Greg
More information about the lldb-commits
mailing list