[commit: packages/integer-gmp] master: Optimize order of pattern matches for export operations (d43d362)

git at git.haskell.org git at git.haskell.org
Thu Nov 7 23:38:33 UTC 2013


Repository : ssh://git@git.haskell.org/integer-gmp

On branch  : master
Link       : http://git.haskell.org/packages/integer-gmp.git/commitdiff/d43d362c0977e681ef9f71f3e38d45cc5b6be8da

>---------------------------------------------------------------

commit d43d362c0977e681ef9f71f3e38d45cc5b6be8da
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Thu Nov 7 23:52:46 2013 +0100

    Optimize order of pattern matches for export operations
    
    These are supposed to be called with `J#`-kind `Integer`s, so check that
    constructor first.
    
    Signed-off-by: Herbert Valerio Riedel <hvr at gnu.org>


>---------------------------------------------------------------

d43d362c0977e681ef9f71f3e38d45cc5b6be8da
 GHC/Integer/Type.lhs |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/GHC/Integer/Type.lhs b/GHC/Integer/Type.lhs
index 1ebe19f..85bccf8 100644
--- a/GHC/Integer/Type.lhs
+++ b/GHC/Integer/Type.lhs
@@ -702,8 +702,8 @@ nextPrimeInteger (J# s d) = case nextPrimeInteger# s d of (# s', d' #) -> J# s'
 --   significant bit of @i at .
 {-# NOINLINE sizeInBaseInteger #-}
 sizeInBaseInteger :: Integer -> Int# -> Word#
-sizeInBaseInteger j@(S# _) b = sizeInBaseInteger (toBig j) b -- TODO
 sizeInBaseInteger (J# s d) b = sizeInBaseInteger# s d b
+sizeInBaseInteger j@(S# _) b = sizeInBaseInteger (toBig j) b -- TODO
 
 -- | Dump 'Integer' (without sign) to mutable byte-array in base-256 representation.
 --
@@ -728,8 +728,8 @@ sizeInBaseInteger (J# s d) b = sizeInBaseInteger# s d b
 -- integers in order to call @mpz_export()@.
 {-# NOINLINE exportIntegerToMutableByteArray #-}
 exportIntegerToMutableByteArray :: Integer -> MutableByteArray# s -> Word# -> Int# -> State# s -> (# State# s, Word# #)
-exportIntegerToMutableByteArray j@(S# _) mba o e = exportIntegerToMutableByteArray (toBig j) mba o e -- TODO
 exportIntegerToMutableByteArray (J# s d) mba o e = exportIntegerToMutableByteArray# s d mba o e
+exportIntegerToMutableByteArray j@(S# _) mba o e = exportIntegerToMutableByteArray (toBig j) mba o e -- TODO
 
 -- | Dump 'Integer' (without sign) to 'Addr#' in base-256 representation.
 --



More information about the ghc-commits mailing list