summaryrefslogtreecommitdiff
path: root/mpfr-impl.h
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2001-08-13 04:48:05 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2001-08-13 04:48:05 +0000
commit52f429b60910cddc90a1f416f2175896fea816a8 (patch)
treec02f816840ac028d5ef87964eb2f7c84cd58a868 /mpfr-impl.h
parente1329af93f718bef1d2bd129c2695af52226b8a3 (diff)
downloadmpfr-52f429b60910cddc90a1f416f2175896fea816a8.tar.gz
Macros MPFR_SET_SAME_SIGN, MPFR_INIT and MPFR_INIT1 changed to expressions.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@1109 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'mpfr-impl.h')
-rw-r--r--mpfr-impl.h24
1 files changed, 13 insertions, 11 deletions
diff --git a/mpfr-impl.h b/mpfr-impl.h
index 6e9943cbe..c12cc7b1b 100644
--- a/mpfr-impl.h
+++ b/mpfr-impl.h
@@ -54,23 +54,25 @@ typedef union ieee_double_extract Ieee_double_extract;
#define MPFR_ISNONNEG(x) (MPFR_NOTZERO((x)) && MPFR_SIGN(x)>=0)
#define MPFR_ISNEG(x) (MPFR_NOTZERO((x)) && MPFR_SIGN(x)==-1)
#define MPFR_CHANGE_SIGN(x) (MPFR_SIZE(x) ^= (((mp_size_t)1)<<31))
-#define MPFR_SET_SAME_SIGN(x, y) if (MPFR_SIGN((x)) != MPFR_SIGN((y))) { MPFR_CHANGE_SIGN((x)); }
+#define MPFR_SET_SAME_SIGN(x, y) \
+ (MPFR_SIGN((x)) != MPFR_SIGN((y)) && MPFR_CHANGE_SIGN((x)))
#define MPFR_PREC(x) ((x)->_mpfr_prec)
-#define MPFR_NOTZERO(x) (MPFR_MANT(x)[(MPFR_PREC(x)-1)/BITS_PER_MP_LIMB] != (mp_limb_t) 0)
-#define MPFR_IS_ZERO(x) (MPFR_MANT(x)[(MPFR_PREC(x)-1)/BITS_PER_MP_LIMB] == (mp_limb_t) 0)
-#define MPFR_SET_ZERO(x) (MPFR_MANT(x)[(MPFR_PREC(x)-1)/BITS_PER_MP_LIMB] = (mp_limb_t) 0)
+#define MPFR_NOTZERO(x) \
+ (MPFR_MANT(x)[(MPFR_PREC(x)-1)/BITS_PER_MP_LIMB] != (mp_limb_t) 0)
+#define MPFR_IS_ZERO(x) \
+ (MPFR_MANT(x)[(MPFR_PREC(x)-1)/BITS_PER_MP_LIMB] == (mp_limb_t) 0)
+#define MPFR_SET_ZERO(x) \
+ (MPFR_MANT(x)[(MPFR_PREC(x)-1)/BITS_PER_MP_LIMB] = (mp_limb_t) 0)
/* Memory gestion */
/* temporary allocate s limbs at xp, and initialize mpfr variable x */
-#define MPFR_INIT(xp, x, p, s) do { \
- xp = (mp_ptr) TMP_ALLOC((s)*BYTES_PER_MP_LIMB); \
- MPFR_PREC(x) = p; MPFR_MANT(x) = xp; MPFR_SIZE(x) = s; MPFR_EXP(x) = 0; \
- } while (0)
+#define MPFR_INIT(xp, x, p, s) \
+ (xp = (mp_ptr) TMP_ALLOC((s)*BYTES_PER_MP_LIMB), \
+ MPFR_PREC(x) = p, MPFR_MANT(x) = xp, MPFR_SIZE(x) = s, MPFR_EXP(x) = 0)
/* same when xp is already allocated */
-#define MPFR_INIT1(xp, x, p, s) do { \
- MPFR_PREC(x)=p; MPFR_MANT(x)=xp; MPFR_SIZE(x)=s; \
- } while (0)
+#define MPFR_INIT1(xp, x, p, s) \
+ (MPFR_PREC(x) = p, MPFR_MANT(x) = xp, MPFR_SIZE(x) = s)
#ifndef _PROTO
#if defined (__STDC__) || defined (__cplusplus)