diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2017-01-12 21:40:50 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2017-01-12 21:40:50 +0000 |
commit | edaf9d5f31b86afa7543bf4a203dfa124641a62e (patch) | |
tree | 78f01216f53c4f3d9719651e232dd337098235db /src/mpfr-gmp.h | |
parent | 020eb2175542cff10b254f3e5b42ef34464c8d8e (diff) | |
download | mpfr-edaf9d5f31b86afa7543bf4a203dfa124641a62e.tar.gz |
fixed bug in urandomb.c reported by Dominic Chen
(https://sympa.inria.fr/sympa/arc/mpfr/2017-01/msg00011.html)
and replaced MPN_COPY_INCR/MPN_COPY_DECR by mpn_copyi/mpn_copyd
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@11193 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/mpfr-gmp.h')
-rw-r--r-- | src/mpfr-gmp.h | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/mpfr-gmp.h b/src/mpfr-gmp.h index af30f5f7c..cad80346c 100644 --- a/src/mpfr-gmp.h +++ b/src/mpfr-gmp.h @@ -126,10 +126,6 @@ void *alloca (size_t); /* MP_LIMB macros */ #define MPN_ZERO(dst, n) memset((dst), 0, (n)*MPFR_BYTES_PER_MP_LIMB) -/* TODO: add MPFR_ASSERTD assertions for MPN_COPY_DECR and MPN_COPY_INCR, - even though memmove works with any overlapping. Useful to detect bugs! */ -#define MPN_COPY_DECR(dst,src,n) memmove((dst),(src),(n)*MPFR_BYTES_PER_MP_LIMB) -#define MPN_COPY_INCR(dst,src,n) memmove((dst),(src),(n)*MPFR_BYTES_PER_MP_LIMB) #define MPN_COPY(dst,src,n) \ do \ { \ @@ -454,12 +450,13 @@ typedef struct {mp_limb_t inv32;} mpfr_pi1_t; } while (0) #endif -/* mpn_copyd is a new exported function in GMP 5. - It existed in GMP 4 in the internal header, but still may not be - defined if HAVE_NATIVE_mpn_copyd is not defined */ +/* mpn_copyi and mpn_copyd are new exported functions in GMP 5. + Defining them to memmove works in overlap cases. */ #if !__MPFR_GMP(5,0,0) +# undef mpn_copyi +# define mpn_copyi memmove # undef mpn_copyd -# define mpn_copyd MPN_COPY +# define mpn_copyd memmove #endif /* The following macro is copied from GMP-6.1.1, file gmp-impl.h, |