diff options
Diffstat (limited to 'Build/source/libs/mpfr/mpfr-src/src/mpfr-impl.h')
-rw-r--r-- | Build/source/libs/mpfr/mpfr-src/src/mpfr-impl.h | 107 |
1 files changed, 83 insertions, 24 deletions
diff --git a/Build/source/libs/mpfr/mpfr-src/src/mpfr-impl.h b/Build/source/libs/mpfr/mpfr-src/src/mpfr-impl.h index 5ce52ac21d1..cce39c3824f 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/mpfr-impl.h +++ b/Build/source/libs/mpfr/mpfr-src/src/mpfr-impl.h @@ -1,7 +1,7 @@ /* Utilities for MPFR developers, not exported. -Copyright 1999-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -234,6 +234,10 @@ typedef __gmp_const mp_limb_t *mpfr_limb_srcptr; ************* Global Internal Variables ************** ******************************************************/ +#if defined (__cplusplus) +extern "C" { +#endif + /* Cache struct */ struct __gmpfr_cache_s { mpfr_t x; @@ -243,32 +247,86 @@ struct __gmpfr_cache_s { typedef struct __gmpfr_cache_s mpfr_cache_t[1]; typedef struct __gmpfr_cache_s *mpfr_cache_ptr; -#if defined (__cplusplus) -extern "C" { +#if __GMP_LIBGMP_DLL +# define MPFR_WIN_THREAD_SAFE_DLL 1 #endif -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR unsigned int __gmpfr_flags; -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_exp_t __gmpfr_emin; -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_exp_t __gmpfr_emax; -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_prec_t __gmpfr_default_fp_bit_precision; -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_rnd_t __gmpfr_default_rounding_mode; -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_cache_const_euler; -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_cache_const_catalan; +/* Detect some possible inconsistencies under Unix. */ +#if defined(__unix__) +# if defined(_WIN32) +# error "Both __unix__ and _WIN32 are defined" +# endif +# if __GMP_LIBGMP_DLL +# error "__unix__ is defined and __GMP_LIBGMP_DLL is true" +# endif +# if defined(MPFR_WIN_THREAD_SAFE_DLL) +# error "Both __unix__ and MPFR_WIN_THREAD_SAFE_DLL are defined" +# endif +#endif -#ifndef MPFR_USE_LOGGING -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_cache_const_pi; -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_cache_const_log2; -#else +#if defined(__MPFR_WITHIN_MPFR) || !defined(MPFR_WIN_THREAD_SAFE_DLL) +extern MPFR_THREAD_ATTR unsigned int __gmpfr_flags; +extern MPFR_THREAD_ATTR mpfr_exp_t __gmpfr_emin; +extern MPFR_THREAD_ATTR mpfr_exp_t __gmpfr_emax; +extern MPFR_THREAD_ATTR mpfr_prec_t __gmpfr_default_fp_bit_precision; +extern MPFR_THREAD_ATTR mpfr_rnd_t __gmpfr_default_rounding_mode; +extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_cache_const_euler; +extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_cache_const_catalan; +# ifndef MPFR_USE_LOGGING +extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_cache_const_pi; +extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_cache_const_log2; +# else /* Two constants are used by the logging functions (via mpfr_fprintf, then mpfr_log, for the base conversion): pi and log(2). Since the mpfr_cache function isn't re-entrant when working on the same cache, we need to define two caches for each constant. */ -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_normal_pi; -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_normal_log2; -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_logging_pi; -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_logging_log2; -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_cache_ptr __gmpfr_cache_const_pi; -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_cache_ptr __gmpfr_cache_const_log2; +extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_normal_pi; +extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_normal_log2; +extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_logging_pi; +extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_logging_log2; +extern MPFR_THREAD_ATTR mpfr_cache_ptr __gmpfr_cache_const_pi; +extern MPFR_THREAD_ATTR mpfr_cache_ptr __gmpfr_cache_const_log2; +# endif +#endif + +#ifdef MPFR_WIN_THREAD_SAFE_DLL +__MPFR_DECLSPEC unsigned int * __gmpfr_flags_f(); +__MPFR_DECLSPEC mpfr_exp_t * __gmpfr_emin_f(); +__MPFR_DECLSPEC mpfr_exp_t * __gmpfr_emax_f(); +__MPFR_DECLSPEC mpfr_prec_t * __gmpfr_default_fp_bit_precision_f(); +__MPFR_DECLSPEC mpfr_rnd_t * __gmpfr_default_rounding_mode_f(); +__MPFR_DECLSPEC mpfr_cache_t * __gmpfr_cache_const_euler_f(); +__MPFR_DECLSPEC mpfr_cache_t * __gmpfr_cache_const_catalan_f(); +# ifndef MPFR_USE_LOGGING +__MPFR_DECLSPEC mpfr_cache_t * __gmpfr_cache_const_pi_f(); +__MPFR_DECLSPEC mpfr_cache_t * __gmpfr_cache_const_log2_f(); +# else +__MPFR_DECLSPEC mpfr_cache_t * __gmpfr_normal_pi_f(); +__MPFR_DECLSPEC mpfr_cache_t * __gmpfr_normal_log2_f(); +__MPFR_DECLSPEC mpfr_cache_t * __gmpfr_logging_pi_f(); +__MPFR_DECLSPEC mpfr_cache_t * __gmpfr_logging_log2_f(); +__MPFR_DECLSPEC mpfr_cache_ptr * __gmpfr_cache_const_pi_f(); +__MPFR_DECLSPEC mpfr_cache_ptr * __gmpfr_cache_const_log2_f(); +# endif +# ifndef __MPFR_WITHIN_MPFR +# define __gmpfr_flags (*__gmpfr_flags_f()) +# define __gmpfr_emin (*__gmpfr_emin_f()) +# define __gmpfr_emax (*__gmpfr_emax_f()) +# define __gmpfr_default_fp_bit_precision (*__gmpfr_default_fp_bit_precision_f()) +# define __gmpfr_default_rounding_mode (*__gmpfr_default_rounding_mode_f()) +# define __gmpfr_cache_const_euler (*__gmpfr_cache_const_euler_f()) +# define __gmpfr_cache_const_catalan (*__gmpfr_cache_const_catalan_f()) +# ifndef MPFR_USE_LOGGING +# define __gmpfr_cache_const_pi (*__gmpfr_cache_const_pi_f()) +# define __gmpfr_cache_const_log2 (*__gmpfr_cache_const_log2_f()) +# else +# define __gmpfr_normal_pi (*__gmpfr_normal_pi_f()) +# define __gmpfr_logging_pi (*__gmpfr_logging_pi_f()) +# define __gmpfr_logging_log2 (*__gmpfr_logging_log2_f()) +# define __gmpfr_cache_const_pi (*__gmpfr_cache_const_pi_f()) +# define __gmpfr_cache_const_log2 (*__gmpfr_cache_const_log2_f()) +# endif +# endif #endif #define BASE_MAX 62 @@ -864,7 +922,7 @@ typedef intmax_t mpfr_eexp_t; #define MPFR_IS_LIKE_RNDD(rnd, sign) \ ((rnd==MPFR_RNDD) || (rnd==MPFR_RNDZ && sign>0) || (rnd==MPFR_RNDA && sign<0)) -/* Invert a rounding mode, RNDZ and RNDA are unchanged */ +/* Invert a rounding mode, RNDN, RNDZ and RNDA are unchanged */ #define MPFR_INVERT_RND(rnd) ((rnd == MPFR_RNDU) ? MPFR_RNDD : \ ((rnd == MPFR_RNDD) ? MPFR_RNDU : rnd)) @@ -994,7 +1052,7 @@ extern unsigned char *mpfr_stack; #define mpfr_const_catalan(_d,_r) mpfr_cache(_d,__gmpfr_cache_const_catalan,_r) #define MPFR_DECL_INIT_CACHE(_cache,_func) \ - mpfr_cache_t MPFR_THREAD_ATTR _cache = \ + MPFR_THREAD_ATTR mpfr_cache_t _cache = \ {{{{0,MPFR_SIGN_POS,0,(mp_limb_t*)0}},0,_func}} @@ -1875,7 +1933,8 @@ __MPFR_DECLSPEC int mpfr_round_raw_4 _MPFR_PROTO ((mp_limb_t *, __MPFR_DECLSPEC int mpfr_check _MPFR_PROTO ((mpfr_srcptr)); __MPFR_DECLSPEC int mpfr_sum_sort _MPFR_PROTO ((mpfr_srcptr *const, - unsigned long, mpfr_srcptr *)); + unsigned long, mpfr_srcptr *, + mpfr_prec_t *)); __MPFR_DECLSPEC int mpfr_get_cputime _MPFR_PROTO ((void)); |