<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">I got the code from Ian Ollman - he sent it as part of the radar :)<div>I could well switch over to llvm::APFloat if it does support printing! (as Greg’s followup email seems to imply)</div><div><br><div>
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div style=" orphans: 2; widows: 2; border-collapse: separate; border-spacing: 0px;"><span style="font-size: 12px; orphans: auto; widows: auto;">Enrico Granata</span><br style="font-size: 12px; orphans: auto; widows: auto;"><span style="font-size: 12px; orphans: auto; widows: auto;">📩 egranata@</span><font color="#ff2600" style="font-size: 12px; orphans: auto; widows: auto;"></font><span style="font-size: 12px; orphans: auto; widows: auto;">.com</span><br style="font-size: 12px; orphans: auto; widows: auto;"><span style="font-size: 12px; orphans: auto; widows: auto;">☎️ 27683</span></div></div></div>
</div>
<br><div><div>On Jun 10, 2013, at 8:48 PM, Chris Lattner <<a href="mailto:clattner@apple.com">clattner@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br>On Jun 10, 2013, at 5:18 PM, Enrico Granata <<a href="mailto:egranata@apple.com">egranata@apple.com</a>> wrote:<br><br><blockquote type="cite">+++ lldb/trunk/source/Core/DataExtractor.cpp Mon Jun 10 19:18:18 2013<br>@@ -1302,6 +1302,22 @@ DumpAPInt (Stream *s, const DataExtracto<br>   return offset;<br>}<br><br>+static float half2float (uint16_t half)<br>+{<br>+    union{ float       f; uint32_t    u;}u;<br>+    int32_t v = (int16_t) half;<br>+    <br>+    if( 0 == (v & 0x7c00))<br>+    {<br>+        u.u = v & 0x80007FFFU;<br>+        return u.f * 0x1.0p125f;<br>+    }<br>+    <br>+    v <<= 13;<br>+    u.u = v | 0x70000000U;<br>+    return u.f * 0x1.0p-112f;<br>+}<br>+<br></blockquote><br>Hi Enrico,<br><br>Where did you get this algorithm?  Did you consider using llvm::APFloat to do this for you?<br><br>-Chris</div></blockquote></div><br></div></body></html>