[commit: integer-gmp] master: integer-gmp: mpn_gcd_1 allocate one Word on stack instead of 'sizeof (__mpz_struct)' (5c3efa4)

Ian Lynagh igloo at earth.li
Mon Mar 18 12:03:48 CET 2013


Repository : ssh://darcs.haskell.org//srv/darcs/packages/integer-gmp

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/5c3efa4e9c2c370adaf80ed04223b717d039621e

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

commit 5c3efa4e9c2c370adaf80ed04223b717d039621e
Author: Sergei Trofimovich <slyfox at gentoo.org>
Date:   Wed Mar 13 23:41:21 2013 +0300

    integer-gmp: mpn_gcd_1 allocate one Word on stack instead of 'sizeof (__mpz_struct)'
    
    gmp.h defines 'mpn_gcd_1' as following:
        mp_limb_t mpn_gcd_1 (mp_srcptr /* aka 'mp_limb_t *'  */, mp_size_t, mp_limb_t);
    
    Signed-off-by: Sergei Trofimovich <slyfox at gentoo.org>

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

 cbits/gmp-wrappers.cmm |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/cbits/gmp-wrappers.cmm b/cbits/gmp-wrappers.cmm
index 0390eb5..8a201f1 100644
--- a/cbits/gmp-wrappers.cmm
+++ b/cbits/gmp-wrappers.cmm
@@ -394,9 +394,9 @@ integer_cmm_gcdIntzh (W_ int1, W_ int2)
     W_ r;
     W_ mp_tmp_w;
 
-    STK_CHK_GEN_N (1 * SIZEOF_MP_INT);
+    STK_CHK_GEN_N (1 * SIZEOF_W);
 
-    mp_tmp_w = Sp - 1 * SIZEOF_MP_INT;
+    mp_tmp_w = Sp - 1 * SIZEOF_W;
 
     W_[mp_tmp_w] = int1;
     (r) = ccall __gmpn_gcd_1(mp_tmp_w "ptr", 1, int2);





More information about the ghc-commits mailing list