summaryrefslogtreecommitdiff
path: root/src/mpfr-gmp.h
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2016-12-30 09:10:24 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2016-12-30 09:10:24 +0000
commit30d03cd651f9ad618473a8c6524215484a2a7608 (patch)
treeb2b7c11074a6e7af6f7189eec18c10215c68996d /src/mpfr-gmp.h
parent7678108f925608af10566eceb18606f7275366df (diff)
downloadmpfr-30d03cd651f9ad618473a8c6524215484a2a7608.tar.gz
[src/invert_limb.c] new file for __gmpfr_invert_limb internal function
(only provided so far for 64-bit limb) [src/div.c] mpfr_div_1 and mpfr_div_2 don't require --enable-gmp-internals any more git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@11106 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/mpfr-gmp.h')
-rw-r--r--src/mpfr-gmp.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/mpfr-gmp.h b/src/mpfr-gmp.h
index 0f3abd0de..8afdef1f1 100644
--- a/src/mpfr-gmp.h
+++ b/src/mpfr-gmp.h
@@ -462,7 +462,6 @@ typedef struct {mp_limb_t inv32;} mpfr_pi1_t;
# define mpn_copyd MPN_COPY
#endif
-#if defined(WANT_GMP_INTERNALS) && defined(HAVE___GMPN_INVERT_LIMB)
/* The following macro is copied from GMP-6.1.1, file gmp-impl.h,
macro udiv_qrnnd_preinv.
It computes q and r such that nh*2^GMP_NUMB_BITS + nl = q*d + r,
@@ -496,6 +495,20 @@ typedef struct {mp_limb_t inv32;} mpfr_pi1_t;
(q) = _qh; \
} while (0)
+#if GMP_NUMB_BITS == 64
+/* specialized version for nl = 0, with di computed inside */
+#define __udiv_qrnd_preinv(q, r, nh, d) \
+ do { \
+ mp_limb_t _di; \
+ \
+ MPFR_ASSERTD ((d) != 0); \
+ MPFR_ASSERTD ((nh) < (d)); \
+ MPFR_ASSERTD ((d) & MPFR_LIMB_HIGHBIT); \
+ \
+ _di = __gmpfr_invert_limb (d); \
+ __udiv_qrnnd_preinv (q, r, nh, 0, d, _di); \
+ } while (0)
+#elif defined(WANT_GMP_INTERNALS) && defined(HAVE___GMPN_INVERT_LIMB)
/* specialized version for nl = 0, with di computed inside */
#define __udiv_qrnd_preinv(q, r, nh, d) \
do { \