<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 15 July 2013 18:50, 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">
<div class="im">On 15 July 2013 16:22, Don Clugston <<a href="mailto:dclugston@gmail.com">dclugston@gmail.com</a>> wrote:<br>
><br>
><br>
> On 15 July 2013 11:46, Iain Buclaw <<a href="mailto:ibuclaw@ubuntu.com">ibuclaw@ubuntu.com</a>> wrote:<br>
>><br>
>> But for floor and ceil, at least one of the following must be<br>
>> available in CTFE to allow setting bits.<br>
>><br>
>> ----<br>
>> // Cannot convert &real to ushort* at compile time<br>
>> real y = x;<br>
>> ushort* sh = cast(ushort*)&y;<br>
><br>
><br>
><br>
> Yeah. The problem with this, is that what happens if somebody stores the<br>
> pointer? It introduces loads of special cases.<br>
><br>
> The most minimal solution would be to explicitly allow:<br>
><br>
> ushort e = *(cast ushort *)&y;<br>
> *(cast ushort *)&y = e;<br>
><br>
<br>
</div>Hmm, how about static arrays of the same size?  This is safer because<br>
of copy semantics (e is a copy of y).<br>
<br>
ushort[8] e = *cast(ushort[8]*)&y;<br>
y = *cast(real *)&e;<br></blockquote><div><br></div><div class="h5">True. But I don't think you would ever write runtime code that way, it seems quite unnatural since it is so slow. <br></div></div>Could certainly be done.<br>
</div></div>