[PATCH] integer-gmp: mpn_gcd_1 allocate one Word on stack instead of 'sizeof (__mpz_struct)'

Sergei Trofimovich slyich at gmail.com
Wed Mar 13 21:41:21 CET 2013


From: Sergei Trofimovich <slyfox at gentoo.org>

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 file 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);
-- 
1.8.1.2




More information about the ghc-devs mailing list