summaryrefslogtreecommitdiff
path: root/libraries/integer-simple/GHC
diff options
context:
space:
mode:
authorJan Stolarek <jan.stolarek@p.lodz.pl>2013-05-16 15:09:53 +0200
committerJan Stolarek <jan.stolarek@p.lodz.pl>2013-07-03 15:16:19 +0100
commit5564980be4f03eac453140d9a361c245f55b3fc2 (patch)
tree36b75f682847ddeeef0a6a7218e2141a19d0d063 /libraries/integer-simple/GHC
parent06bc377d33bd4bed8f0fe7a769c34cf7c6e0d643 (diff)
downloadhaskell-5564980be4f03eac453140d9a361c245f55b3fc2.tar.gz
Comparison primops return Int# (Fixes #6135)
For a deatiled discussion of this changes please visit the wiki page: http://hackage.haskell.org/trac/ghc/wiki/PrimBool
Diffstat (limited to 'libraries/integer-simple/GHC')
-rw-r--r--libraries/integer-simple/GHC/Integer.hs2
-rw-r--r--libraries/integer-simple/GHC/Integer/Logarithms/Internals.hs1
-rw-r--r--libraries/integer-simple/GHC/Integer/Type.hs83
3 files changed, 53 insertions, 33 deletions
diff --git a/libraries/integer-simple/GHC/Integer.hs b/libraries/integer-simple/GHC/Integer.hs
index 2128ddc93e..f419b2f592 100644
--- a/libraries/integer-simple/GHC/Integer.hs
+++ b/libraries/integer-simple/GHC/Integer.hs
@@ -27,6 +27,8 @@ module GHC.Integer (
plusInteger, minusInteger, timesInteger, negateInteger,
eqInteger, neqInteger, absInteger, signumInteger,
leInteger, gtInteger, ltInteger, geInteger, compareInteger,
+ eqInteger#, neqInteger#,
+ leInteger#, gtInteger#, ltInteger#, geInteger#,
divInteger, modInteger,
divModInteger, quotRemInteger, quotInteger, remInteger,
encodeFloatInteger, decodeFloatInteger, floatFromInteger,
diff --git a/libraries/integer-simple/GHC/Integer/Logarithms/Internals.hs b/libraries/integer-simple/GHC/Integer/Logarithms/Internals.hs
index 3e3fbb1ee5..baf0afa575 100644
--- a/libraries/integer-simple/GHC/Integer/Logarithms/Internals.hs
+++ b/libraries/integer-simple/GHC/Integer/Logarithms/Internals.hs
@@ -18,6 +18,7 @@ module GHC.Integer.Logarithms.Internals
) where
import GHC.Prim
+import GHC.PrimWrappers
import GHC.Integer.Type
default ()
diff --git a/libraries/integer-simple/GHC/Integer/Type.hs b/libraries/integer-simple/GHC/Integer/Type.hs
index f87f1c314f..703301c181 100644
--- a/libraries/integer-simple/GHC/Integer/Type.hs
+++ b/libraries/integer-simple/GHC/Integer/Type.hs
@@ -23,6 +23,7 @@
module GHC.Integer.Type where
import GHC.Prim
+import GHC.PrimWrappers
import GHC.Classes
import GHC.Types
import GHC.Tuple ()
@@ -424,45 +425,61 @@ Naught `compareInteger` Negative _ = GT
Negative x `compareInteger` Negative y = y `comparePositive` x
(!_) `compareInteger` (!_) = LT
-{-# NOINLINE eqInteger #-}
-eqInteger :: Integer -> Integer -> Bool
-x `eqInteger` y = case x `compareInteger` y of
- EQ -> True
- _ -> False
+{-# NOINLINE eqInteger# #-}
+eqInteger# :: Integer -> Integer -> Int#
+x `eqInteger#` y = case x `compareInteger` y of
+ EQ -> 1#
+ _ -> 0#
-{-# NOINLINE neqInteger #-}
-neqInteger :: Integer -> Integer -> Bool
-x `neqInteger` y = case x `compareInteger` y of
- EQ -> False
- _ -> True
+{-# NOINLINE neqInteger# #-}
+neqInteger# :: Integer -> Integer -> Int#
+x `neqInteger#` y = case x `compareInteger` y of
+ EQ -> 0#
+ _ -> 1#
+
+{-# INLINE eqInteger #-}
+{-# INLINE neqInteger #-}
+eqInteger, neqInteger :: Integer -> Integer -> Bool
+eqInteger a b = tagToEnum# (a `eqInteger#` b)
+neqInteger a b = tagToEnum# (a `neqInteger#` b)
instance Eq Integer where
(==) = eqInteger
(/=) = neqInteger
-{-# NOINLINE ltInteger #-}
-ltInteger :: Integer -> Integer -> Bool
-x `ltInteger` y = case x `compareInteger` y of
- LT -> True
- _ -> False
-
-{-# NOINLINE gtInteger #-}
-gtInteger :: Integer -> Integer -> Bool
-x `gtInteger` y = case x `compareInteger` y of
- GT -> True
- _ -> False
-
-{-# NOINLINE leInteger #-}
-leInteger :: Integer -> Integer -> Bool
-x `leInteger` y = case x `compareInteger` y of
- GT -> False
- _ -> True
-
-{-# NOINLINE geInteger #-}
-geInteger :: Integer -> Integer -> Bool
-x `geInteger` y = case x `compareInteger` y of
- LT -> False
- _ -> True
+{-# NOINLINE ltInteger# #-}
+ltInteger# :: Integer -> Integer -> Int#
+x `ltInteger#` y = case x `compareInteger` y of
+ LT -> 1#
+ _ -> 0#
+
+{-# NOINLINE gtInteger# #-}
+gtInteger# :: Integer -> Integer -> Int#
+x `gtInteger#` y = case x `compareInteger` y of
+ GT -> 1#
+ _ -> 0#
+
+{-# NOINLINE leInteger# #-}
+leInteger# :: Integer -> Integer -> Int#
+x `leInteger#` y = case x `compareInteger` y of
+ GT -> 0#
+ _ -> 1#
+
+{-# NOINLINE geInteger# #-}
+geInteger# :: Integer -> Integer -> Int#
+x `geInteger#` y = case x `compareInteger` y of
+ LT -> 0#
+ _ -> 1#
+
+{-# INLINE leInteger #-}
+{-# INLINE ltInteger #-}
+{-# INLINE geInteger #-}
+{-# INLINE gtInteger #-}
+leInteger, gtInteger, ltInteger, geInteger :: Integer -> Integer -> Bool
+leInteger a b = tagToEnum# (a `leInteger#` b)
+gtInteger a b = tagToEnum# (a `gtInteger#` b)
+ltInteger a b = tagToEnum# (a `ltInteger#` b)
+geInteger a b = tagToEnum# (a `geInteger#` b)
instance Ord Integer where
(<=) = leInteger