diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2018-09-05 15:53:50 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2018-09-05 15:53:50 +0000 |
commit | bff479a722cd4d6e091a3a0f540e92a705a5bb8d (patch) | |
tree | f20bfc736738d9d0b11a4203667d7ccce4225527 | |
parent | 673f53b3614d0e33375a2896fa1dfc6c03066366 (diff) | |
download | mpfr-bff479a722cd4d6e091a3a0f540e92a705a5bb8d.tar.gz |
[src/set_d64.c] 2 fixes concerning rp[]:
* If GMP_NUMB_BITS >= 64, there is a shift of 32 bits, thus one
uses mp_limb_t (> 32 bits) instead of unsigned int.
* Otherwise use unsigned long as an unsigned int might be on 16 bits.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@13145 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r-- | src/set_d64.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/set_d64.c b/src/set_d64.c index 304098b5a..ba8f07151 100644 --- a/src/set_d64.c +++ b/src/set_d64.c @@ -123,8 +123,12 @@ decimal64_to_string (char *s, _Decimal64 d) #ifdef DPD_FORMAT unsigned int d0, d1, d2, d3, d4, d5; #else - unsigned int rp[2]; /* rp[0] and rp[1] should contain at least 32 bits */ -#define NLIMBS (64 / GMP_NUMB_BITS) +#if GMP_NUMB_BITS >= 64 + mp_limb_t rp[2]; +#else + unsigned long rp[2]; /* rp[0] and rp[1] should contain at least 32 bits */ +#endif +#define NLIMBS (64 / GMP_NUMB_BITS) mp_limb_t sp[NLIMBS]; mp_size_t sn; #endif @@ -215,7 +219,7 @@ decimal64_to_string (char *s, _Decimal64 d) sp[2] = MPFR_LIMB(rp[1]); sp[3] = MPFR_LIMB(rp[1] >> 16); #else -#error "GMP_NUMB_BITS should be 16, 32, or >= 64" +#error "GMP_NUMB_BITS should be 16, 32, or >= 64" #endif sn = NLIMBS; while (sn > 0 && sp[sn - 1] == 0) |