diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2015-10-29 09:44:03 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2015-10-29 09:44:03 +0000 |
commit | 20714e3c09fe0d3fa19ccf33c0a43cc908383c41 (patch) | |
tree | cb1cdb494d681e07f7d8afc21e61c15f6704ffbb /src/mpfr-mini-gmp.c | |
parent | 055f887fb71ed9d3d7a4877c461918a7c8e55cc8 (diff) | |
download | mpfr-20714e3c09fe0d3fa19ccf33c0a43cc908383c41.tar.gz |
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
Diffstat (limited to 'src/mpfr-mini-gmp.c')
-rw-r--r-- | src/mpfr-mini-gmp.c | 4 |
1 files changed, 3 insertions, 1 deletions
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 |