On Fri, Jul 09, 2010 at 07:14:58AM -1000, Lennart Augustsson wrote:
> That might not work if the alignment constraints differ between the two types.
Easy enough to fix, just compare the alignments and alloca with the
greater of the two. the optimizer should be able to optimize out the
test.
of c
On 08/07/2010 17:56, Daniel Fischer wrote:
On Thursday 08 July 2010 18:15:44, Ian Lynagh wrote:
On Thu, Jul 08, 2010 at 04:49:00PM +0200, Daniel Fischer wrote:
unsafeCoerce# :: Word64# -> Double# ?
By the docs, that isn't supposed to work. Is it not supposed to work
only because it's not valu
On Thu, Jul 08, 2010 at 04:49:00PM +0200, Daniel Fischer wrote:
> If there are more pitfalls, is there any chance of getting a function which
> reinterprets the bit-patterns?
Hi, you can do something like this (untested):
castWordToFloat :: Word32 -> Float
castWordToFloat w = unsafePerformIO $ d
On Thursday 08 July 2010 18:15:44, Ian Lynagh wrote:
> On Thu, Jul 08, 2010 at 04:49:00PM +0200, Daniel Fischer wrote:
> > unsafeCoerce# :: Word64# -> Double# ?
> >
> > By the docs, that isn't supposed to work. Is it not supposed to work
> > only because it's not value-preserving (unsafeCoerce# 1##
On Thu, Jul 08, 2010 at 04:49:00PM +0200, Daniel Fischer wrote:
>
> unsafeCoerce# :: Word64# -> Double# ?
>
> By the docs, that isn't supposed to work. Is it not supposed to work only
> because it's not value-preserving (unsafeCoerce# 1## /=## 1.0##) or are
> there more pitfalls?
It can fail t
The docs for unsafeCoerce# say:
"The following uses of unsafeCoerce# are supposed to work (i.e. not lead to
spurious compile-time or run-time crashes):
# Casting any lifted type to Any
# Casting Any back to the real type
# Casting an unboxed type to another unboxed type of the same size (but not