summaryrefslogtreecommitdiff
path: root/src/set_d64.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2018-06-22 11:42:30 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2018-06-22 11:42:30 +0000
commit15673bca5bc170741b6bb35dcbb950a1dfead800 (patch)
tree4aca9da772b95bbe9a9fe88386054bfcf71af1da /src/set_d64.c
parent68af9eed1800641ff5bd63dbf34d26d2f9746535 (diff)
downloadmpfr-15673bca5bc170741b6bb35dcbb950a1dfead800.tar.gz
[src/set_d64.c] Code improvement (like r12809 and r12828 in set_d128.c).
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@12832 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/set_d64.c')
-rw-r--r--src/set_d64.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/set_d64.c b/src/set_d64.c
index 71fd191da..85b493d4a 100644
--- a/src/set_d64.c
+++ b/src/set_d64.c
@@ -119,11 +119,12 @@ decimal64_to_string (char *s, _Decimal64 d)
char *t;
unsigned int Gh; /* most 5 significant bits from combination field */
int exp; /* exponent */
- mp_limb_t rp[2];
- mp_size_t rn = 2;
unsigned int i;
#ifdef DPD_FORMAT
unsigned int d0, d1, d2, d3, d4, d5;
+#else
+ mp_limb_t rp[2];
+ mp_size_t rn;
#endif
/* now convert BID or DPD to string */
@@ -198,9 +199,11 @@ decimal64_to_string (char *s, _Decimal64 d)
rp[1] &= 524287; /* 2^19-1: cancel G[11] */
rp[1] |= 2097152; /* add 2^21 */
}
-#if GMP_NUMB_BITS >= 54
+#if GMP_NUMB_BITS >= 64
rp[0] |= rp[1] << 32;
rn = 1;
+#else
+ rn = 2;
#endif
while (rn > 0 && rp[rn - 1] == 0)
rn --;