summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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))