projects
/
ghc-base.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
bb1ac04
)
Add integer-simple as a build option
author
Ian Lynagh
<igloo@earth.li>
Wed, 22 Jul 2009 01:31:51 +0000
(
01:31
+0000)
committer
Ian Lynagh
<igloo@earth.li>
Wed, 22 Jul 2009 01:31:51 +0000
(
01:31
+0000)
GHC/Real.lhs
patch
|
blob
|
history
base.cabal
patch
|
blob
|
history
diff --git
a/GHC/Real.lhs
b/GHC/Real.lhs
index
6a3f335
..
f4d3e5e
100644
(file)
--- a/
GHC/Real.lhs
+++ b/
GHC/Real.lhs
@@
-449,6
+449,7
@@
lcm _ 0 = 0
lcm 0 _ = 0
lcm x y = abs ((x `quot` (gcd x y)) * y)
lcm 0 _ = 0
lcm x y = abs ((x `quot` (gcd x y)) * y)
+#ifdef OPTIMISE_INTEGER_GCD_LCM
{-# RULES
"gcd/Int->Int->Int" gcd = gcdInt
"gcd/Integer->Integer->Integer" gcd = gcdInteger'
{-# RULES
"gcd/Int->Int->Int" gcd = gcdInt
"gcd/Integer->Integer->Integer" gcd = gcdInteger'
@@
-465,6
+466,7
@@
gcdInteger' a b = gcdInteger a b
gcdInt :: Int -> Int -> Int
gcdInt 0 0 = error "GHC.Real.gcdInt: gcd 0 0 is undefined"
gcdInt a b = fromIntegral (gcdInteger (fromIntegral a) (fromIntegral b))
gcdInt :: Int -> Int -> Int
gcdInt 0 0 = error "GHC.Real.gcdInt: gcd 0 0 is undefined"
gcdInt a b = fromIntegral (gcdInteger (fromIntegral a) (fromIntegral b))
+#endif
integralEnumFrom :: (Integral a, Bounded a) => a -> [a]
integralEnumFrom n = map fromInteger [toInteger n .. toInteger (maxBound `asTypeOf` n)]
integralEnumFrom :: (Integral a, Bounded a) => a -> [a]
integralEnumFrom n = map fromInteger [toInteger n .. toInteger (maxBound `asTypeOf` n)]
diff --git
a/base.cabal
b/base.cabal
index
f94f185
..
01fad68
100644
(file)
--- a/
base.cabal
+++ b/
base.cabal
@@
-23,9
+23,16
@@
source-repository head
type: darcs
location: http://darcs.haskell.org/packages/base/
type: darcs
location: http://darcs.haskell.org/packages/base/
+Flag integer-simple
+ Description: Use integer-simple
+
Library {
if impl(ghc) {
Library {
if impl(ghc) {
- build-depends: integer-gmp
+ if flag(integer-simple)
+ build-depends: integer-simple
+ else
+ build-depends: integer-gmp
+ ghc-options: -DOPTIMISE_INTEGER_GCD_LCM
build-depends: rts, ghc-prim
exposed-modules:
Foreign.Concurrent,
build-depends: rts, ghc-prim
exposed-modules:
Foreign.Concurrent,