[commit: base] master: Move divInt#/modInt# to ghc-prim (69fb277)
Ian Lynagh
igloo at earth.li
Wed Jun 20 14:36:17 CEST 2012
Repository : ssh://darcs.haskell.org//srv/darcs/packages/base
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/69fb277558b199d6d8861218d8d332108de4937c
>---------------------------------------------------------------
commit 69fb277558b199d6d8861218d8d332108de4937c
Author: Ian Lynagh <igloo at earth.li>
Date: Tue Jun 19 19:20:46 2012 +0100
Move divInt#/modInt# to ghc-prim
This allows them to be shared with integer-gmp
>---------------------------------------------------------------
GHC/Base.lhs | 21 ---------------------
1 files changed, 0 insertions(+), 21 deletions(-)
diff --git a/GHC/Base.lhs b/GHC/Base.lhs
index f684563..c6c21d6 100644
--- a/GHC/Base.lhs
+++ b/GHC/Base.lhs
@@ -655,27 +655,6 @@ getTag x = x `seq` dataToTag# x
%* *
%*********************************************************
-\begin{code}
-divInt# :: Int# -> Int# -> Int#
-x# `divInt#` y#
- -- Be careful NOT to overflow if we do any additional arithmetic
- -- on the arguments... the following previous version of this
- -- code has problems with overflow:
--- | (x# ># 0#) && (y# <# 0#) = ((x# -# y#) -# 1#) `quotInt#` y#
--- | (x# <# 0#) && (y# ># 0#) = ((x# -# y#) +# 1#) `quotInt#` y#
- | (x# ># 0#) && (y# <# 0#) = ((x# -# 1#) `quotInt#` y#) -# 1#
- | (x# <# 0#) && (y# ># 0#) = ((x# +# 1#) `quotInt#` y#) -# 1#
- | otherwise = x# `quotInt#` y#
-
-modInt# :: Int# -> Int# -> Int#
-x# `modInt#` y#
- | (x# ># 0#) && (y# <# 0#) ||
- (x# <# 0#) && (y# ># 0#) = if r# /=# 0# then r# +# y# else 0#
- | otherwise = r#
- where
- !r# = x# `remInt#` y#
-\end{code}
-
Definitions of the boxed PrimOps; these will be
used in the case of partial applications, etc.
More information about the Cvs-libraries
mailing list