Recent changes to mpn_get_str/mpn_set_str

Torbjörn Granlund tg at gmplib.org
Tue Feb 14 02:10:13 UTC 2017


"Marco Bodrato" <bodrato at mail.dm.unipi.it> writes:

  A first attempt is attached.

Cool!

  It is not specialised for base 10, and it is not faster than current code
  if only a few limbs must be converted, but around 10 limbs it should be a
  gain.

That's expected, I think.

  For some bases it the current code is particularly slow for a single
  limb... the attached one is faster in those cases...
  
Which bases?

  > power will be available.  One should be computed with mpn_pow_1 (or a
  > new mpn_1_pow_1 (or whatever to call it; it would take a mp_limb_t base
  > unlike mpn_pow_1 which takes a (mp_ptr,mp_size_t) base).
  
  I quickly wrote a sort-of pow_1, but this part needs refinement.
  
We have some pow_1 code of different leves of complexity; mpz/n_pow_ui.c
is pretty hairy while mpn/generic/pow_1.c is simpler.  I think the
latter is perfectly suitable for get_str's needs (the mpz code checks
for bases which are much smaller than the max limb value, then
conditionally performs some limb steps).

-- 
Torbjörn
Please encrypt, key id 0xC8601622


More information about the gmp-devel mailing list