From c2504af4fb78af526ef2bc2043c7de43b371b7a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Wed, 16 Nov 2011 07:34:58 +0000 Subject: [PATCH] fix rounding on negative number shifting avoid allocating unnecessary space. --- C/gmp_support.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/C/gmp_support.c b/C/gmp_support.c index 7304b0244..657f34536 100644 --- a/C/gmp_support.c +++ b/C/gmp_support.c @@ -377,16 +377,16 @@ Yap_gmp_sll_big_int(Term t, Int i) MP_INT *b = Yap_BigIntOfTerm(t); if (i > 0) { - mpz_init_set(&new, b); - mpz_mul_2exp(&new, &new, i); + mpz_init(&new); + mpz_mul_2exp(&new, b, i); } else if (i == 0) { return t; } else { - mpz_init_set(&new, b); + mpz_init(&new); if (i == Int_MIN) { return Yap_ArithError(RESOURCE_ERROR_HUGE_INT, MkIntegerTerm(i), "<