From 20714e3c09fe0d3fa19ccf33c0a43cc908383c41 Mon Sep 17 00:00:00 2001 From: zimmerma Date: Thu, 29 Oct 2015 09:44:03 +0000 Subject: fixed replacement for mpn_neg (return value was wrong) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@9704 280ebfd0-de03-0410-8827-d642c229c3f4 --- src/mpfr-mini-gmp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/mpfr-mini-gmp.c') diff --git a/src/mpfr-mini-gmp.c b/src/mpfr-mini-gmp.c index 57e8614ba..e8ae8fe58 100644 --- a/src/mpfr-mini-gmp.c +++ b/src/mpfr-mini-gmp.c @@ -59,7 +59,9 @@ mpn_neg (mp_limb_t *rp, const mp_limb_t *sp, mp_size_t n) for (i = 0; i < n; i++) rp[i] = ~sp[i]; - return mpn_add_1 (rp, rp, n, (mp_limb_t) 1); + /* the return value of mpn_neg is the borrow as if we subtracted + {sp, n} from {0, n}, i.e., it is always 1 unless {sp, n} is zero */ + return 1 - mpn_add_1 (rp, rp, n, (mp_limb_t) 1); } #endif -- cgit v1.2.1