mpn_sec_minvert name

bodrato at mail.dm.unipi.it bodrato at mail.dm.unipi.it
Mon Jan 27 08:40:40 UTC 2014


Ciao,

Il Sab, 18 Gennaio 2014 9:41 am, Niels ha scritto:

> I've now added sec_add_1 and sec_sub_1 (which I think are of some
> importance for applications).

> Also mpn_sec_sub_1, trivial as it looks, is currently untested. I guess
> it should be fairly easy to add tests for both new functions to
> tests/mpn/t-aors_1.c.

Some warning arise while compiling the current tests/mpn/t-aors_1.c:
"passing argument 2 of ‘__gmpn_sec_add_1’ discards ‘const’
qualifier"...

May I suggest the following patch? I now it is kind of opposite the
"volatile" proposal to force non-optimising the function...


diff -r e7532d3e6158 gmp-h.in
--- a/gmp-h.in  Mon Jan 27 07:53:17 2014 +0100
+++ b/gmp-h.in  Mon Jan 27 09:29:47 2014 +0100
@@ -1628,12 +1628,12 @@
 __GMP_DECLSPEC mp_limb_t mpn_cnd_sub_n (mp_limb_t, mp_ptr, mp_srcptr,
mp_srcptr, mp_size_t);

 #define mpn_sec_add_1 __MPN(sec_add_1)
-__GMP_DECLSPEC mp_limb_t mpn_sec_add_1 (mp_limb_t *, mp_limb_t *,
mp_size_t, mp_limb_t, mp_ptr);
+__GMP_DECLSPEC mp_limb_t mpn_sec_add_1 (mp_ptr, mp_srcptr, mp_size_t,
mp_limb_t, mp_ptr);
 #define mpn_sec_add_1_itch __MPN(sec_add_1_itch)
 __GMP_DECLSPEC mp_size_t mpn_sec_add_1_itch (mp_size_t)
__GMP_ATTRIBUTE_PURE;

 #define mpn_sec_sub_1 __MPN(sec_sub_1)
-__GMP_DECLSPEC mp_limb_t mpn_sec_sub_1 (mp_limb_t *, mp_limb_t *,
mp_size_t, mp_limb_t, mp_ptr);
+__GMP_DECLSPEC mp_limb_t mpn_sec_sub_1 (mp_ptr, mp_srcptr, mp_size_t,
mp_limb_t, mp_ptr);
 #define mpn_sec_sub_1_itch __MPN(sec_sub_1_itch)
 __GMP_DECLSPEC mp_size_t mpn_sec_sub_1_itch (mp_size_t)
__GMP_ATTRIBUTE_PURE;

diff -r e7532d3e6158 mpn/generic/sec_aors_1.c
--- a/mpn/generic/sec_aors_1.c  Mon Jan 27 07:53:17 2014 +0100
+++ b/mpn/generic/sec_aors_1.c  Mon Jan 27 09:29:47 2014 +0100
@@ -41,7 +41,7 @@
 }

 mp_limb_t
-FNAME (mp_limb_t *rp, mp_limb_t *ap, mp_size_t n, mp_limb_t b,
+FNAME (mp_limb_t *rp, const mp_limb_t *ap, mp_size_t n, mp_limb_t b,
        mp_ptr scratch)
 {
   scratch[0] = b;



Regards,
m

-- 
http://bodrato.it/papers/



More information about the gmp-devel mailing list