summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2014-03-02 08:32:16 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2014-03-02 08:32:16 +0000
commitf5287a69ee2fd1f00a7213f08c552e7262d512ca (patch)
treeb58b43767ed71434505c70f8cf54e31a4c69d3ea /src
parent88b43fe57c9d370ee6d33b872605ce01d16bf8a3 (diff)
downloadmpfr-f5287a69ee2fd1f00a7213f08c552e7262d512ca.tar.gz
[src/mpfr-impl.h] Fixed the mpfr_get_default_rounding_mode() macro for
C++ (it didn't have the correct type), and improved the similar ones. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@8997 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src')
-rw-r--r--src/mpfr-impl.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/mpfr-impl.h b/src/mpfr-impl.h
index 8c1cf5a17..6bed77e79 100644
--- a/src/mpfr-impl.h
+++ b/src/mpfr-impl.h
@@ -258,11 +258,15 @@ __MPFR_DECLSPEC extern const mpfr_t __gmpfr_const_log2_RNDU;
}
#endif
-/* Replace some common functions for direct access to the global vars */
-#define mpfr_get_emin() (__gmpfr_emin + 0)
-#define mpfr_get_emax() (__gmpfr_emax + 0)
-#define mpfr_get_default_rounding_mode() (__gmpfr_default_rounding_mode + 0)
-#define mpfr_get_default_prec() (__gmpfr_default_fp_bit_precision + 0)
+/* Replace some common functions for direct access to the global vars.
+ The casts prevent these macros from being used as a lvalue (and this
+ method makes sure that the expressions have the correct type). */
+#define mpfr_get_emin() ((mpfr_exp_t) __gmpfr_emin)
+#define mpfr_get_emax() ((mpfr_exp_t) __gmpfr_emax)
+#define mpfr_get_default_rounding_mode() \
+ ((mpfr_rnd_t) __gmpfr_default_rounding_mode)
+#define mpfr_get_default_prec() \
+ ((mpfr_prec_t) __gmpfr_default_fp_bit_precision)
/* Flags related macros. */
/* Note: Function-like macros that modify __gmpfr_flags are not defined