fast inversion

bodrato at mail.dm.unipi.it bodrato at mail.dm.unipi.it
Tue May 19 04:07:06 UTC 2015


Ciao Paul,

Il Lun, 18 Maggio 2015 11:33 am, paul zimmermann ha scritto:
>> >       mpn_neg_n (tp, tp, n);
>
> should be mpn_neg instead? I have put this in

Yes, of course.

>> Anyway, in your code you should probably write:
>>    mpn_com (tp + l, tp + l, h); /* Amended the _n ;-) */
>>    mpn_add_1 (tp + l, tp + l, h, mpn_zero_p (tp, l));
>
> I don't see mpn_zero_p in the API of the current stable version 6.0.0
> (according to gmplib.org). In which version will it be available?

Well, you use mpn_com_n (it have never been in the official API), you
#include "gmp-impl.h" ... but you are right we should try to expose in the
official API all the functions that can have a stable interface and can
help programmers using GMP.

mpn_zero_p is in gmp-impl.h since 2008:
https://gmplib.org/repo/gmp/diff/2c043a0b21fe/gmp-impl.h

Do you feel it might be useful?

We should probably add some more instruments to inspect and compare numbers.
This loosely relates to a message I sent two years ago about mpz_cmp_ui
(https://gmplib.org/list-archives/gmp-devel/2013-February/002807.html ).
The questions are: do we prefer macros or (possibly inlined) functions for
this tasks? Which instruments do we need?

Best regards,
m

-- 
http://bodrato.it/



More information about the gmp-devel mailing list