summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2017-06-05 17:06:13 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2017-06-05 17:06:13 +0000
commit9c013c6c1dfb294a55e0e3c2561f1e08f0105de0 (patch)
tree1140325eeac3c5cd5418dcb42ff46bf7eff7d54e
parent76cab3b81c4506e171536b1d52c99f834e8a502a (diff)
downloadmpfr-9c013c6c1dfb294a55e0e3c2561f1e08f0105de0.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. (merged changeset r8997 from the trunk; needed by r11579 when using a C++ compiler) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@11580 280ebfd0-de03-0410-8827-d642c229c3f4
-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 4c4b8ec06..bee38a909 100644
--- a/src/mpfr-impl.h
+++ b/src/mpfr-impl.h
@@ -349,11 +349,15 @@ __MPFR_DECLSPEC extern const mpfr_t __gmpfr_four;
#define MPFR_FLAGS_DIVBY0 32
#define MPFR_FLAGS_ALL 63
-/* 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)
#define mpfr_clear_flags() \
((void) (__gmpfr_flags = 0))