diff options
author | Ian Lynagh <igloo@earth.li> | 2012-01-26 13:58:04 +0000 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2012-01-26 14:55:20 +0000 |
commit | 299f286e016681bad3fc5d106fd305aaf418a17f (patch) | |
tree | ecc3fa3ceee75abb9498f4134aac3e51e383efde /libraries/integer-gmp/GHC | |
parent | fda76752e98eb0c613b5aaf1c3f3a765f63e5a6c (diff) | |
download | haskell-299f286e016681bad3fc5d106fd305aaf418a17f.tar.gz |
Add some rules; fixes #5767
We now have rules for
integerToInt (smallInteger x) = x
integerToWord (wordToInteger x) = x
integerToInt64 (int64ToInteger x) = x
integerToWord64 (word64ToInteger x) = x
Diffstat (limited to 'libraries/integer-gmp/GHC')
-rw-r--r-- | libraries/integer-gmp/GHC/Integer/Type.lhs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libraries/integer-gmp/GHC/Integer/Type.lhs b/libraries/integer-gmp/GHC/Integer/Type.lhs index 401544d205..94bd4dd100 100644 --- a/libraries/integer-gmp/GHC/Integer/Type.lhs +++ b/libraries/integer-gmp/GHC/Integer/Type.lhs @@ -90,6 +90,11 @@ smallInteger i = S# i wordToInteger :: Word# -> Integer wordToInteger w = case word2Integer# w of (# s, d #) -> J# s d +{-# RULES +"integerToInt/smallInteger" forall x . integerToInt (smallInteger x) = x +"integerToWord/wordToInteger" forall x . integerToWord (wordToInteger x) = x + #-} + {-# NOINLINE integerToWord #-} integerToWord :: Integer -> Word# integerToWord (S# i) = int2Word# i @@ -120,6 +125,11 @@ int64ToInteger i = if ((i `leInt64#` intToInt64# 0x7FFFFFFF#) && then smallInteger (int64ToInt# i) else case int64ToInteger# i of (# s, d #) -> J# s d + +{-# RULES +"integerToInt64/int64ToInteger" forall x . integerToInt64 (int64ToInteger x) = x +"integerToWord64/word64ToInteger" forall x . integerToWord64 (word64ToInteger x) = x + #-} #endif integerToInt :: Integer -> Int# |