[commit: base] master: Simplify how gcd @ Int is implemented (a8b47d5)
Ian Lynagh
igloo at earth.li
Fri Jul 20 15:48:22 CEST 2012
Repository : ssh://darcs.haskell.org//srv/darcs/packages/base
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/a8b47d5f6f2b33f18e90c95353c6383c0ccdfa9f
>---------------------------------------------------------------
commit a8b47d5f6f2b33f18e90c95353c6383c0ccdfa9f
Author: Ian Lynagh <igloo at earth.li>
Date: Wed Jul 18 15:33:28 2012 +0100
Simplify how gcd @ Int is implemented
>---------------------------------------------------------------
GHC/Real.lhs | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/GHC/Real.lhs b/GHC/Real.lhs
index a011989..67389b6 100644
--- a/GHC/Real.lhs
+++ b/GHC/Real.lhs
@@ -657,13 +657,13 @@ lcm x y = abs ((x `quot` (gcd x y)) * y)
#ifdef OPTIMISE_INTEGER_GCD_LCM
{-# RULES
-"gcd/Int->Int->Int" gcd = gcdInt
+"gcd/Int->Int->Int" gcd = gcdInt'
"gcd/Integer->Integer->Integer" gcd = gcdInteger
"lcm/Integer->Integer->Integer" lcm = lcmInteger
#-}
-gcdInt :: Int -> Int -> Int
-gcdInt a b = fromIntegral (gcdInteger (fromIntegral a) (fromIntegral b))
+gcdInt' :: Int -> Int -> Int
+gcdInt' (I# x) (I# y) = I# (gcdInt x y)
#endif
integralEnumFrom :: (Integral a, Bounded a) => a -> [a]
More information about the Cvs-libraries
mailing list