mpx_set_str2(mpx_t, const char*, const char*, int) suggestion
Pierre Chatelier
pierre at chachatelier.fr
Fri Nov 27 19:53:53 UTC 2015
Hello,
Currently the various mpx structures (mpz_t, mpq_t, mpf_t) have an output function similar to :
mpx_set_str(mpx_t r, const char *sp, int base)
For the sake of performance, I suggest a new prototype mpx_set_str2(mpx_t r, const char *start, const char* end, int base) (where [start;end[ is the string to consider)
For me, the interest is :
-I looked at the current implementation of mpz_t. It seems very easy to change
-It saves a call to strlen() in the current implementation
-users of gmplib do not need to create intermediate strings with '\0' terminator when parsing substring from complex input data
If necessary, I can submit a patch, but what do you think at first sight ?
Regards,
Pierre Chatelier
More information about the gmp-discuss
mailing list