diff options
Diffstat (limited to 'Build/source/libs/mpfr/mpfr-src/src/get_sj.c')
-rw-r--r-- | Build/source/libs/mpfr/mpfr-src/src/get_sj.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Build/source/libs/mpfr/mpfr-src/src/get_sj.c b/Build/source/libs/mpfr/mpfr-src/src/get_sj.c index 41715892618..2e217787ca4 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/get_sj.c +++ b/Build/source/libs/mpfr/mpfr-src/src/get_sj.c @@ -1,6 +1,6 @@ /* mpfr_get_sj -- convert a MPFR number to a huge machine signed integer -Copyright 2004, 2006-2018 Free Software Foundation, Inc. +Copyright 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H @@ -90,7 +90,7 @@ mpfr_get_sj (mpfr_srcptr f, mpfr_rnd_t rnd) (even though xp[n] == 0 in such a case). This can happen if sizeof(mp_limb_t) < sizeof(intmax_t) and |x| is small enough because of the trailing bits due to its normalization. */ - for (n = MPFR_LIMB_SIZE (x) - 1; n >= 0 && sh >= 0; n--) + for (n = MPFR_LIMB_SIZE (x) - 1; n >= 0 && sh > 0; n--) { sh -= GMP_NUMB_BITS; /* Note the concerning the casts below: @@ -100,7 +100,7 @@ mpfr_get_sj (mpfr_srcptr f, mpfr_rnd_t rnd) for the case sizeof(intmax_t) == sizeof(mp_limb_t), as mp_limb_t is unsigned, therefore not representable as an intmax_t when the MSB is 1 (this is the case here). */ - MPFR_ASSERTD (sh < GMP_NUMB_BITS && -sh < GMP_NUMB_BITS); + MPFR_ASSERTD (-sh < GMP_NUMB_BITS); r += (sh >= 0 ? (intmax_t) xp[n] << sh : (intmax_t) (xp[n] >> (-sh))); @@ -109,10 +109,10 @@ mpfr_get_sj (mpfr_srcptr f, mpfr_rnd_t rnd) else { /* See the comments for the case x positive. */ - for (n = MPFR_LIMB_SIZE (x) - 1; n >= 0 && sh >= 0; n--) + for (n = MPFR_LIMB_SIZE (x) - 1; n >= 0 && sh > 0; n--) { sh -= GMP_NUMB_BITS; - MPFR_ASSERTD (sh < GMP_NUMB_BITS && -sh < GMP_NUMB_BITS); + MPFR_ASSERTD (-sh < GMP_NUMB_BITS); r -= (sh >= 0 ? (intmax_t) xp[n] << sh : (intmax_t) (xp[n] >> (-sh))); |