diff options
author | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2003-11-17 14:43:54 +0000 |
---|---|---|
committer | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2003-11-17 14:43:54 +0000 |
commit | c59abbe962268a65eda822b85787802fdc45f812 (patch) | |
tree | 5a393b247bfd44273614562939c24b958177f554 /mul.c | |
parent | f3ec3c948ac523a73c8bae0e85592c87bc627a41 (diff) | |
download | mpfr-c59abbe962268a65eda822b85787802fdc45f812.tar.gz |
* Optimize a few div.c and mul.c.
* Reorder the tests.
* Remove mpfr_round_raw_generic and create 4 new functions which replace it, for efficiency reasons.
* Add round_raw_generic.c which is the generic file to create the 4 new functions.
* Add new MACRO: MPFR_RNDUTEST_OR_RNDDNOTTEST which is a faster way to check if (rnd_mode==GMP_RNDU && test) || (rnd_mode==GMP_RNDD && !test).
* Add new MACRO: MPFR_UNSIGNED_MINUS_MODULO.
* Optimize mpfr_can_round_raw.
* Some new defines in mpfr.h to increase compatibility with MPFR v2.0.1 and above.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2550 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'mul.c')
-rw-r--r-- | mul.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -96,12 +96,13 @@ mpfr_mul (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode) * It is usefull iff the precision is big, there is an overflow * and we are doing further mults... Probable ? */ /* - if (bx + cx > __gmpfr_emax + 1) + if (MPFR_UNLIKELY(bx + cx > __gmpfr_emax + 1)) return mpfr_set_overflow (a, rnd_mode, sign_product); - if (bx + cx < __gmpfr_emin - 2) + if (MPFR_UNLIKELY(bx + cx < __gmpfr_emin - 2)) return mpfr_set_underflow (a, rnd_mode == GMP_RNDN ? GMP_RNDZ : rnd_mode, - sign_product); + sign_product); */ + ap = MPFR_MANT(a); bp = MPFR_MANT(b); cp = MPFR_MANT(c); @@ -109,8 +110,8 @@ mpfr_mul (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode) aq = MPFR_PREC(a); bq = MPFR_PREC(b); cq = MPFR_PREC(c); - if (MPFR_UNLIKELY(bq+cq < bq)) - MPFR_ASSERTN(0); /* no integer overflow */ + + MPFR_ASSERTD(bq+cq > bq); /* PREC_MAX is /2 so no integer overflow */ an = (aq-1)/BITS_PER_MP_LIMB + 1; /* number of significant limbs of a */ bn = (bq-1)/BITS_PER_MP_LIMB + 1; /* number of significant limbs of b */ |