summaryrefslogtreecommitdiff
path: root/mpf
diff options
context:
space:
mode:
authorMarco Bodrato <bodrato@mail.dm.unipi.it>2017-02-08 09:28:25 +0100
committerMarco Bodrato <bodrato@mail.dm.unipi.it>2017-02-08 09:28:25 +0100
commitb1044a537377c626c29d183bdd3019752c66088a (patch)
treee6c1726c30ddbda51bbca890d3c1f31bb50a20db /mpf
parent75c28aee1763192fc8133d84a888ef072ceab132 (diff)
downloadgmp-b1044a537377c626c29d183bdd3019752c66088a.tar.gz
mp[fz]/get_str.c, mpz/out_str.c: Save a string and a branch.
Diffstat (limited to 'mpf')
-rw-r--r--mpf/get_str.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/mpf/get_str.c b/mpf/get_str.c
index 9a731334a..5f34dabfb 100644
--- a/mpf/get_str.c
+++ b/mpf/get_str.c
@@ -138,26 +138,23 @@ mpf_get_str (char *dbuf, mp_exp_t *exp, int base, size_t n_digits, mpf_srcptr u)
un = ABSIZ(u);
ue = EXP(u);
- if (base >= 0)
+ num_to_text = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+ if (base > 1)
{
- num_to_text = "0123456789abcdefghijklmnopqrstuvwxyz";
- if (base <= 1)
- base = 10;
- else if (base > 36)
- {
- num_to_text = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
- if (base > 62)
+ if (base <= 36)
+ num_to_text = "0123456789abcdefghijklmnopqrstuvwxyz";
+ else if (UNLIKELY (base > 62))
return NULL;
- }
+ }
+ else if (base > -2)
+ {
+ base = 10;
}
else
{
base = -base;
- if (base <= 1)
- base = 10;
- else if (base > 36)
+ if (UNLIKELY (base > 36))
return NULL;
- num_to_text = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
}
MPF_SIGNIFICANT_DIGITS (max_digits, base, PREC(u));