data-binary-ieee754 0.4.3 → 0.4.4
raw patch · 2 files changed
+13/−11 lines, 2 filesdep ~basedep ~binaryPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, binary
API changes (from Hackage documentation)
Files
data-binary-ieee754.cabal view
@@ -1,5 +1,5 @@ name: data-binary-ieee754-version: 0.4.3+version: 0.4.4 license: MIT license-file: license.txt author: John Millikin <jmillikin@gmail.com>@@ -20,13 +20,13 @@ tests/tests.cabal source-repository head- type: bazaar- location: https://john-millikin.com/branches/data-binary-ieee754/0.4/+ type: git+ location: https://john-millikin.com/code/haskell-binary-ieee754/ source-repository this- type: bazaar- location: https://john-millikin.com/branches/data-binary-ieee754/0.4/- tag: data-binary-ieee754_0.4.3+ type: git+ location: https://john-millikin.com/code/haskell-binary-ieee754/+ tag: data-binary-ieee754_0.4.4 library ghc-options: -Wall -O2
lib/Data/Binary/IEEE754.hs view
@@ -23,11 +23,13 @@ , doubleToWord, wordToDouble ) where -import Prelude hiding (exp)-import Data.Bits (shiftL, shiftR, (.|.), (.&.))+import Prelude hiding (exp)+import Data.Bits (shiftL, shiftR, (.|.), (.&.))+import qualified Foreign as F+import System.IO.Unsafe (unsafePerformIO)+ import qualified Data.Binary.Get as G import qualified Data.Binary.Put as P-import qualified Foreign as F getFloat16be :: G.Get Float getFloat16be = fmap toFloat16 G.getWord16be@@ -72,12 +74,12 @@ wordToDouble = toFloat toFloat :: (F.Storable word, F.Storable float) => word -> float-toFloat word = F.unsafePerformIO $ F.alloca $ \buf -> do+toFloat word = unsafePerformIO $ F.alloca $ \buf -> do F.poke (F.castPtr buf) word F.peek buf fromFloat :: (F.Storable word, F.Storable float) => float -> word-fromFloat float = F.unsafePerformIO $ F.alloca $ \buf -> do+fromFloat float = unsafePerformIO $ F.alloca $ \buf -> do F.poke (F.castPtr buf) float F.peek buf