Re: mpn_neg

2015-04-29 Thread tg
ni...@lysator.liu.se (Niels Möller) writes: t...@gmplib.org writes: Not sure why we're doing this as an inline function in gmp.h. Me neither. Perhaps as it is tiny? I think inlines in gmp.h makes sense for functions which are tiny and O(1) in the common case, like

Re: fast inversion

2015-04-29 Thread tg
ni...@lysator.liu.se (Niels Möller) writes: I'd suggest something like this (totally untested) mp_limb_t mpn_neg (mp_ptr rp, mp_srcptr up, mp_size_t n) { /* Low zero limbs are unchanged by negation. */ while (*up == 0) { *rp++ = 0; up++;

Re: fast inversion

2015-04-29 Thread tg
I just noticed that the fast mpn_com in x86_64/fastsse is not really used, making calls to mpn_com from the inlined mpn_neg perform poorly. I'll address this soon. -- Torbjörn Please encrypt, key id 0xC8601622 ___ gmp-devel mailing list

Re: fast inversion

2015-04-27 Thread tg
bodr...@mail.dm.unipi.it writes: After a first glance to the code, two lines surprise me: mpn_com_n (tp, tp, n); mpn_add_1 (tp, tp, n, ONE); I wondered why you didn't use mpn_neg_n (tp, tp, n); Then I tested (on shell@gmplib) and... @shell ~/gmp-repo$ tune/speed

Re: mpn_redc_n

2015-03-30 Thread tg
paul zimmermann paul.zimmerm...@inria.fr writes: we might use mpn_redc_n in GMP-ECM, depending on tuning results wrt mpn_redc_1, mpn_redc_2, and other functions. I presume you've noticed that this function is booming out THIS IS AN INTERNAL FUNCTION WITH A MUTABLE INTERFACE. IT IS