diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2016-06-06 23:43:44 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2016-06-06 23:43:44 +0000 |
commit | 11851de31420e372e9885ffa663d5557599c3a48 (patch) | |
tree | d2d4787ff79d0b6eb0965ebc76f8fb6fb3fb767c | |
parent | b91d95a975f59c200fd8f455064a19dd2c588173 (diff) | |
download | mpfr-11851de31420e372e9885ffa663d5557599c3a48.tar.gz |
[src/uceil_log2.c] Correction in __gmpfr_ceil_log2, avoiding an
incorrect result with tcc: x.s.exp is declared as an unsigned
bit-field, so that tcc considers that x.s.exp - 1023 is unsigned.
However, since all the values of x.s.exp are representable in an
int, according to the integer promotion rules, x.s.exp should be
converted to an int, so that the subtraction is signed. So, this
appears to be a bug in tcc.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@10443 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r-- | src/uceil_log2.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/uceil_log2.c b/src/uceil_log2.c index bfb799cae..27aaca353 100644 --- a/src/uceil_log2.c +++ b/src/uceil_log2.c @@ -33,7 +33,7 @@ __gmpfr_ceil_log2 (double d) union mpfr_ieee_double_extract x; x.d = d; - exp = x.s.exp - 1023; + exp = (long) x.s.exp - 1023; x.s.exp = 1023; /* value for 1 <= d < 2 */ if (x.d != 1.0) /* d: not a power of two? */ exp++; |