diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2012-03-26 14:40:34 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2012-03-26 14:40:34 +0000 |
commit | e51e528654637f87bceaa78b28692ff6851f7a58 (patch) | |
tree | 8136dd7c58d6cb7f739454329de8ef7bd57f9dec /src | |
parent | d174cbec56809cb5c6e079f09927525e71b83cba (diff) | |
download | mpfr-e51e528654637f87bceaa78b28692ff6851f7a58.tar.gz |
[src] New mpfr_flags_t type, defined as an unsigned int. For the
__gmpfr_flags variable and internal flags-related variables,
replaced unsigned int by mpfr_flags_t (note that this doesn't
change the ABI, since unsigned int was already used).
[tests] Cast __gmpfr_flags to unsigned int when printed with %u.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@8130 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src')
-rw-r--r-- | src/atan2.c | 2 | ||||
-rw-r--r-- | src/exceptions.c | 2 | ||||
-rw-r--r-- | src/gmp_op.c | 2 | ||||
-rw-r--r-- | src/mpfr-impl.h | 6 | ||||
-rw-r--r-- | src/mpfr.h | 8 | ||||
-rw-r--r-- | src/round_near_x.c | 2 |
6 files changed, 15 insertions, 7 deletions
diff --git a/src/atan2.c b/src/atan2.c index d190acdcc..60a61f072 100644 --- a/src/atan2.c +++ b/src/atan2.c @@ -159,7 +159,7 @@ mpfr_atan2 (mpfr_ptr dest, mpfr_srcptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) { int r; mpfr_t yoverx; - unsigned int saved_flags = __gmpfr_flags; + mpfr_flags_t saved_flags = __gmpfr_flags; mpfr_init2 (yoverx, MPFR_PREC (y)); if (MPFR_LIKELY (mpfr_div_2si (yoverx, y, MPFR_GET_EXP (x) - 1, diff --git a/src/exceptions.c b/src/exceptions.c index 793b67c61..e83115e8b 100644 --- a/src/exceptions.c +++ b/src/exceptions.c @@ -22,7 +22,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #include "mpfr-impl.h" -unsigned int MPFR_THREAD_ATTR __gmpfr_flags = 0; +mpfr_flags_t MPFR_THREAD_ATTR __gmpfr_flags = 0; mpfr_exp_t MPFR_THREAD_ATTR __gmpfr_emin = MPFR_EMIN_DEFAULT; mpfr_exp_t MPFR_THREAD_ATTR __gmpfr_emax = MPFR_EMAX_DEFAULT; diff --git a/src/gmp_op.c b/src/gmp_op.c index 88966f3c7..335b37edc 100644 --- a/src/gmp_op.c +++ b/src/gmp_op.c @@ -128,7 +128,7 @@ mpfr_cmp_z (mpfr_srcptr x, mpz_srcptr z) mpfr_t t; int res; mpfr_prec_t p; - unsigned int flags; + mpfr_flags_t flags; if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x))) return mpfr_cmp_si (x, mpz_sgn (z)); diff --git a/src/mpfr-impl.h b/src/mpfr-impl.h index 5cc63565f..8b8a213c8 100644 --- a/src/mpfr-impl.h +++ b/src/mpfr-impl.h @@ -251,7 +251,7 @@ typedef struct __gmpfr_cache_s *mpfr_cache_ptr; extern "C" { #endif -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR unsigned int __gmpfr_flags; +__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_flags_t __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; @@ -346,7 +346,7 @@ __MPFR_DECLSPEC extern const mpfr_t __gmpfr_four; Note: _op can be either a statement or an expression. MPFR_BLOCK_EXCEP should be used only inside a block; it is useful to detect some exception in order to exit the block as soon as possible. */ -#define MPFR_BLOCK_DECL(_flags) unsigned int _flags +#define MPFR_BLOCK_DECL(_flags) mpfr_flags_t _flags /* The (void) (_flags) makes sure that _flags is read at least once (it makes sense to use MPFR_BLOCK while _flags will never be read in the source, so that we wish to avoid the corresponding warning). */ @@ -1173,7 +1173,7 @@ do { \ temporarily */ typedef struct { - unsigned int saved_flags; + mpfr_flags_t saved_flags; mpfr_exp_t saved_emin; mpfr_exp_t saved_emax; } mpfr_save_expo_t; diff --git a/src/mpfr.h b/src/mpfr.h index ce29a1eaf..fdc893e4a 100644 --- a/src/mpfr.h +++ b/src/mpfr.h @@ -61,6 +61,14 @@ typedef long mpfr_long; typedef unsigned long mpfr_ulong; typedef size_t mpfr_size_t; +/* Global (possibly TLS) flags. Might also be used in an mpfr_t in the + future (there would be room as mpfr_sign_t just needs 1 byte). + TODO: The tests currently assume that the flags fits in an unsigned int; + this should be cleaned up, e.g. by defining a function that outputs the + flags as a string or by using the flags_out function (from tests/tests.c + directly). */ +typedef unsigned int mpfr_flags_t; + /* Definition of rounding modes (DON'T USE MPFR_RNDNA!). Warning! Changing the contents of this enum should be seen as an interface change since the old and the new types are not compatible diff --git a/src/round_near_x.c b/src/round_near_x.c index 6296aee73..d6a9ca6ed 100644 --- a/src/round_near_x.c +++ b/src/round_near_x.c @@ -157,7 +157,7 @@ mpfr_round_near_x (mpfr_ptr y, mpfr_srcptr v, mpfr_uexp_t err, int dir, mpfr_rnd_t rnd) { int inexact, sign; - unsigned int old_flags = __gmpfr_flags; + mpfr_flags_t old_flags = __gmpfr_flags; MPFR_ASSERTD (!MPFR_IS_SINGULAR (v)); MPFR_ASSERTD (dir == 0 || dir == 1); |