mpx_set_str2(mpx_t, const char*, const char*, int) suggestion
Marco Bodrato
bodrato at mail.dm.unipi.it
Sun Nov 29 06:26:13 UTC 2015
Ciao,
Il Ven, 27 Novembre 2015 8:53 pm, Pierre Chatelier ha scritto:
> Currently the various mpx structures (mpz_t, mpq_t, mpf_t) have an
> 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)
The prototype of the underlying mpn function is
mp_size_t mpn_set_str (mp_limb_t *rp, const unsigned char *str, size_t
strsize, int base)
If you use start:end, you need to explain: *end is included or not?
> For me, the interest is :
> -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
>From mpq/set_str.c:
/* FIXME: Would like an mpz_set_mem (or similar) accepting a pointer and
length so we wouldn't have to copy the numerator just to null-terminate
it. */
Regards,
m
--
http://bodrato.it/papers/
More information about the gmp-discuss
mailing list