<div dir="ltr"><div><div><div>There are actually two operations being performed.<br></div>(1) Converting an IEEE float <-> int and double<->long. This is 100% portable. It does not depend on endianness. (Unless endianness of floating point values is different from endianness of integer values, but I don't think you could define BigEndian/LittleEndian in that case, so I'm not sure that D could ever support such a system, and according to Wikipedia there are no such systems which support IEEE754).<br>
<br></div>(2) Converting the compilers internal representation, into an IEEE float. This is not portable.<br><br></div><div>In theory, CTFE only needs (1). But, because it is currently using the compiler's internal representation, it's using (2).<br>
</div><div><br></div><div>I plan to move CTFE to a JIT-compatible implementation, which will mean it will only be using (1) internally. But it will still need (2) when doing the CTFE compile step.<br></div><div></div><div>
<br>Really what should happen is that (2) should be put into port.c/target.c.<br></div><div>To some degree I'm waiting for the D port, when we will have defined sizes for builtin types.<br></div><div><br></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On 27 August 2013 17:42, Iain Buclaw <span dir="ltr"><<a href="mailto:ibuclaw@ubuntu.com" target="_blank">ibuclaw@ubuntu.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 20 August 2013 13:03, Iain Buclaw <<a href="mailto:ibuclaw@ubuntu.com">ibuclaw@ubuntu.com</a>> wrote:<br>
> Hi,<br>
><br>
> Question aimed vaguely at Don.<br>
><br>
> The routine paintFloatInt in ctfeexpr.c is not portable across<br>
> compilers (gdc implements its own way of painting float<->int,<br>
> double<->long through something other than using a union). Would it<br>
> be possible to split this off somewhere, such as port.c/target.c -<br>
> depending on how much of the front-end we need access to in order to<br>
> carry out the operation?<br>
><br>
><br>
<br>
Ping on this.<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
--<br>
Iain Buclaw<br>
<br>
*(p < e ? p++ : p) = (c & 0x0f) + '0';<br>
_______________________________________________<br>
dmd-internals mailing list<br>
<a href="mailto:dmd-internals@puremagic.com">dmd-internals@puremagic.com</a><br>
<a href="http://lists.puremagic.com/mailman/listinfo/dmd-internals" target="_blank">http://lists.puremagic.com/mailman/listinfo/dmd-internals</a><br>
</font></span></blockquote></div><br></div>