Hi,
I'd like to know if this should work:
-- GHC coercion
getFloat :: BHeader - Get Float
getFloat h =
case endianness h of
LittleEndian - fmap (coerce . fromIntegral) getWord32le
BigEndian - fmap (coerce . fromIntegral) getWord32be
where coerce (I32# x) = F# (unsafeCoerce# x)
--
If you don't mind a small performance penalty, have you considered
using my library data-binary-ieee754? It contains functions for
parsing floats and doubles within the Get monad.
On Mon, Sep 14, 2009 at 12:24, minh thu not...@gmail.com wrote:
Hi,
I'd like to know if this should work:
-- GHC
Hi,
Yes I did but since I saw that 'solution', I wanted to try it.
There is something that bothers me with your library: its licence.
Reading a float shouldn't force me to go GPL (I makes an utility to
read Blender files and like to make it BSD3).
Thanks for pointing it though.
Cheers,
Thu
On Mon, Sep 14, 2009 at 12:24 PM, minh thu not...@gmail.com wrote:
Hi,
I'd like to know if this should work:
-- GHC coercion
getFloat :: BHeader - Get Float
getFloat h =
case endianness h of
LittleEndian - fmap (coerce . fromIntegral) getWord32le
BigEndian - fmap (coerce .
2009/9/14 Judah Jacobson judah.jacob...@gmail.com:
On Mon, Sep 14, 2009 at 12:24 PM, minh thu not...@gmail.com wrote:
Hi,
I'd like to know if this should work:
-- GHC coercion
getFloat :: BHeader - Get Float
getFloat h =
case endianness h of
LittleEndian - fmap (coerce .