[commit: integer-gmp] master: Use divInt#/modInt# from ghc-prim (ee07ac3)
Ian Lynagh
igloo at earth.li
Wed Jun 20 14:37:58 CEST 2012
Repository : ssh://darcs.haskell.org//srv/darcs/packages/integer-gmp
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/ee07ac3e75685c9492537d35ef112d9a127cff85
>---------------------------------------------------------------
commit ee07ac3e75685c9492537d35ef112d9a127cff85
Author: Ian Lynagh <igloo at earth.li>
Date: Tue Jun 19 19:21:42 2012 +0100
Use divInt#/modInt# from ghc-prim
>---------------------------------------------------------------
GHC/Integer/Type.lhs | 17 +----------------
1 files changed, 1 insertions(+), 16 deletions(-)
diff --git a/GHC/Integer/Type.lhs b/GHC/Integer/Type.lhs
index 94bd4dd..44cc076 100644
--- a/GHC/Integer/Type.lhs
+++ b/GHC/Integer/Type.lhs
@@ -22,7 +22,7 @@ import GHC.Prim (
int2Word#, int2Double#, int2Float#, word2Int#,
-- Operations on Int# that we use for operations on S#
quotInt#, remInt#, negateInt#,
- (==#), (/=#), (<=#), (>=#), (<#), (>#), (*#), (-#), (+#),
+ (==#), (/=#), (<=#), (>=#), (<#), (>#), (*#), (-#),
mulIntMayOflo#, addIntC#, subIntC#,
and#, or#, xor#
)
@@ -189,21 +189,6 @@ divModInteger (S# i) (S# j) = (# S# d, S# m #)
!d = i `divInt#` j
!m = i `modInt#` j
- -- XXX Copied from GHC.Base
- divInt# :: Int# -> Int# -> Int#
- x# `divInt#` y#
- = if (x# ># 0#) && (y# <# 0#) then ((x# -# 1#) `quotInt#` y#) -# 1#
- else if (x# <# 0#) && (y# ># 0#) then ((x# +# 1#) `quotInt#` y#) -# 1#
- else x# `quotInt#` y#
-
- modInt# :: Int# -> Int# -> Int#
- x# `modInt#` y#
- = if ((x# ># 0#) && (y# <# 0#)) ||
- ((x# <# 0#) && (y# ># 0#))
- then if r# /=# 0# then r# +# y# else 0#
- else r#
- where !r# = x# `remInt#` y#
-
divModInteger i1@(J# _ _) i2@(S# _) = divModInteger i1 (toBig i2)
divModInteger i1@(S# _) i2@(J# _ _) = divModInteger (toBig i1) i2
divModInteger (J# s1 d1) (J# s2 d2)
More information about the Cvs-libraries
mailing list