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

Chris Lattner clattner at apple.com
Mon Jun 10 20:48:03 PDT 2013


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




More information about the lldb-commits mailing list