summaryrefslogtreecommitdiff
path: root/mpfr-gmp.h
diff options
context:
space:
mode:
authorthevenyp <thevenyp@280ebfd0-de03-0410-8827-d642c229c3f4>2008-02-05 17:08:25 +0000
committerthevenyp <thevenyp@280ebfd0-de03-0410-8827-d642c229c3f4>2008-02-05 17:08:25 +0000
commite8f775919fbb7e1b9ea4d610bd27c9c377df67d9 (patch)
tree80c7af6882f87ad48171ca242b1869c4a19c260b /mpfr-gmp.h
parent31f8b7cf4ddcbecdb7f35829009eabda90994426 (diff)
downloadmpfr-e8f775919fbb7e1b9ea4d610bd27c9c377df67d9.tar.gz
MPN_ZERO (dst, n) doesn't call memset when n==0, it prevents warning when compiled with gcc -D_FORTIFY_SOURCE
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@5261 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'mpfr-gmp.h')
-rw-r--r--mpfr-gmp.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/mpfr-gmp.h b/mpfr-gmp.h
index 56869050f..8fd395975 100644
--- a/mpfr-gmp.h
+++ b/mpfr-gmp.h
@@ -92,7 +92,13 @@ extern "C" {
#define SHRT_HIGHBIT SHRT_MIN
/* MP_LIMB macros */
-#define MPN_ZERO(dst, n) memset((dst), 0, (n)*BYTES_PER_MP_LIMB)
+#define MPN_ZERO(dst, n) \
+ do \
+ { \
+ if (n) \
+ memset((dst), 0, (n)*BYTES_PER_MP_LIMB); \
+ } \
+ while (0)
#define MPN_COPY_DECR(dst,src,n) memmove((dst),(src),(n)*BYTES_PER_MP_LIMB)
#define MPN_COPY_INCR(dst,src,n) memmove((dst),(src),(n)*BYTES_PER_MP_LIMB)
#define MPN_COPY(dst,src,n) \