On 15 July 2013 16:22, Don Clugston <[email protected]> wrote: > > > On 15 July 2013 11:46, Iain Buclaw <[email protected]> wrote: >> >> But for floor and ceil, at least one of the following must be >> available in CTFE to allow setting bits. >> >> ---- >> // Cannot convert &real to ushort* at compile time >> real y = x; >> ushort* sh = cast(ushort*)&y; > > > > Yeah. The problem with this, is that what happens if somebody stores the > pointer? It introduces loads of special cases. > > The most minimal solution would be to explicitly allow: > > ushort e = *(cast ushort *)&y; > *(cast ushort *)&y = e; >
Hmm, how about static arrays of the same size? This is safer because of copy semantics (e is a copy of y). ushort[8] e = *cast(ushort[8]*)&y; y = *cast(real *)&e; -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0'; _______________________________________________ dmd-internals mailing list [email protected] http://lists.puremagic.com/mailman/listinfo/dmd-internals
