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 /mpz/out_str.c | |
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 'mpz/out_str.c')
-rw-r--r-- | mpz/out_str.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/mpz/out_str.c b/mpz/out_str.c index 8dfcb31ec..f79a57d8f 100644 --- a/mpz/out_str.c +++ b/mpz/out_str.c @@ -49,26 +49,23 @@ mpz_out_str (FILE *stream, int base, mpz_srcptr x) if (stream == 0) stream = stdout; - 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 0; - } + } + else if (base > -2) + { + base = 10; } else { base = -base; - if (base <= 1) - base = 10; - else if (base > 36) + if (UNLIKELY (base > 36)) return 0; - num_to_text = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; } written = 0; |