diff options
author | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2017-02-08 09:28:25 +0100 |
---|---|---|
committer | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2017-02-08 09:28:25 +0100 |
commit | b1044a537377c626c29d183bdd3019752c66088a (patch) | |
tree | e6c1726c30ddbda51bbca890d3c1f31bb50a20db /mpf | |
parent | 75c28aee1763192fc8133d84a888ef072ceab132 (diff) | |
download | gmp-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.c | 23 |
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)); |