reinterpret-cast-0.1.0: Memory reinterpretation casts for Float/Double and Word32/Word64

Safe Haskell | None
Language | Haskell98

Data.ReinterpretCast

Description

Memory reinterpretation casts for Float/Double and Word32/Word64.

Currently we use the `array` method from http://stackoverflow.com/a/7002812/263061.

If you need something like `Int32` or similar, `fromIntegral` will do the job within the integral types (so to/from `Word*` are the only conversions needed).

Synopsis

- floatToWord :: Float -> Word32
- wordToFloat :: Word32 -> Float
- doubleToWord :: Double -> Word64
- wordToDouble :: Word64 -> Double

# Documentation

floatToWord :: Float -> Word32 Source #

Reinterpret-casts a `Float` to a `Word32`.

wordToFloat :: Word32 -> Float Source #

Reinterpret-casts a `Word32` to a `Float`.

doubleToWord :: Double -> Word64 Source #

Reinterpret-casts a `Double` to a `Word64`.

wordToDouble :: Word64 -> Double Source #

Reinterpret-casts a `Word64` to a `Double`.