[MLton] Experimental 64-bit binary package (& SVN sources)
Daniel C. Wang
danwang at CS.Princeton.EDU
Thu Mar 1 19:48:31 PST 2007
Matthew Fluet wrote:
{stuff deleted}
> Word64. Unfortunately, we don't have a *bitcast* from Real32 to
> Word32; naively emitting
> Real32 r = ...;
> Word32 w = (Word32)r;
> results in coercion that attempts to preserve the numeric meaning
> of r, rather than the bits of r. Simply more evidence that we need
> real/word bitcast primitives.
Need them in the MLton IR or the C-code? This I think does the "right"
thing in ANSIC.
typedef union {
Word32 asWord32;
Reald32 asReal32;
/* ... */
} univ_t;
inline Real32bitstoWord32bits(Word32 w) {
univ_t v;
v.asWord32 = w;
return v.asReal32;
}
using GC expresion statements. i think this is might work also
#define BITCAST(T1,T2,e) ({ univ_t v; v.as##T1 = e;v.as#T2})
More information about the MLton
mailing list