summaryrefslogtreecommitdiff
path: root/Data
diff options
context:
space:
mode:
authorRaphaelJavaux <>2014-06-18 19:34:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2014-06-18 19:34:00 (GMT)
commit208114cd4898af46535abef9ab85044b4c1965d6 (patch)
tree3272f4c28768fc879fba6e510275c81f57e6f5f7 /Data
parenta677ea01a1a27d4ce4d86602dc3ba685cb772b8f (diff)
version 0.1.2HEAD0.1.2master
Diffstat (limited to 'Data')
-rw-r--r--Data/RatioInt.hs12
1 files changed, 8 insertions, 4 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)