[Lldb-commits] [lldb] r183716 - <rdar://problem/12783351>

Enrico Granata egranata at apple.com
Tue Jun 11 10:46:26 PDT 2013


I got the code from Ian Ollman - he sent it as part of the radar :)
I could well switch over to llvm::APFloat if it does support printing! (as Greg’s followup email seems to imply)

Enrico Granata
📩 egranata@.com
☎️ 27683

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?
> 
> -Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20130611/0c90f96d/attachment.html>


More information about the lldb-commits mailing list