summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Data/RatioInt.hs12
-rw-r--r--ratio-int.cabal2
2 files changed, 9 insertions, 5 deletions
diff --git a/Data/RatioInt.hs b/Data/RatioInt.hs
index 7c50954..f96439c 100644
--- a/Data/RatioInt.hs
+++ b/Data/RatioInt.hs
@@ -83,17 +83,21 @@ instance Enum RatioInt where
| otherwise = (>= p + mid)
instance Storable RatioInt where
- sizeOf _ = let !sizeOfInt = sizeOf (undefined :: Int)
- in sizeOfInt + sizeOfInt
+ sizeOf _ = sizeOfInt + sizeOfInt
{-# INLINE sizeOf #-}
alignment _ = alignment (undefined :: Int)
{-# INLINE alignment #-}
peek !ptr = let !ptr' = castPtr ptr
- in RatioInt <$> peek ptr' <*> peek (ptr' `plusPtr` 1)
+ in RatioInt <$> peek ptr'
+ <*> peek (ptr' `plusPtr` sizeOfInt)
{-# INLINE peek #-}
poke !ptr !(RatioInt x y) = let !ptr' = castPtr ptr
- in poke ptr' x >> poke (ptr' `plusPtr` 1) y
+ in poke ptr' x >>
+ poke (ptr' `plusPtr` sizeOfInt) y
{-# INLINE poke #-}
+
+sizeOfInt :: Int
+sizeOfInt = sizeOf (undefined :: Int)
diff --git a/ratio-int.cabal b/ratio-int.cabal
index df9dba0..ad812ea 100644
--- a/ratio-int.cabal
+++ b/ratio-int.cabal
@@ -1,5 +1,5 @@
name: ratio-int
-version: 0.1.1
+version: 0.1.2
license: BSD3
author: Raphael Javaux <raphaeljavaux[at]gmail.com>
maintainer: Raphael Javaux <raphaeljavaux[at]gmail.com>