increase mini-gmp base support to 62

Marco Bodrato bodrato at
Fri Feb 3 18:29:00 UTC 2017


Il Mer, 1 Febbraio 2017 7:20 pm, Niels Möller ha scritto:
> I also prefer the conciser version without the large table.

Applied. But I changed again the code that checks the base. I used the

 digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
 if (base > 1)
     if (base <= 36)
       digits = "0123456789abcdefghijklmnopqrstuvwxyz";
     else if (base > 62)
       return NULL;
 else if (base >= -1)
   base = 10;
     base = -base;
     if (base > 36)
       return NULL;

It uses a constant string less, and it saves a branch in the path for
base>1 if compared to the code used in the main library... I think I'll
recycle this code for mpz/get_str.c , mpf/get_str.c and mpz/out_str.c .

> Looks good. Only detail I don't quite like is the variable name
> "lowercaseoffset". Maybe "value_of_a" (since it's the value of the

Adopted "value_of_a".

Best regards,


More information about the gmp-devel mailing list