Re: mpn_sec_minvert name
ni...@lysator.liu.se (Niels Möller) writes: I think the conclusion was that volatile was not very useful for this function, but if we add that later, does it make any sense to have const volatile *ap? The intended meaning would be that writes are invalid, and that no reads should be optimized away. I think 'const' and 'volatile' are orthogonal. Torbjörn Please encrypt, key id 0xC8601622 ___ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel
Re: mpn_sec_minvert name
bodr...@mail.dm.unipi.it writes: > May I suggest the following patch? I now it is kind of opposite the > "volatile" proposal to force non-optimising the function... You're right a const is missing. Your patch looks fine to me. For consistency, maybe you want to use mp_ptr / mp_srcptr also in the definition in sec_aors_1.c. I think the conclusion was that volatile was not very useful for this function, but if we add that later, does it make any sense to have const volatile *ap? The intended meaning would be that writes are invalid, and that no reads should be optimized away. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26. Internet email is subject to wholesale government surveillance. ___ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel
Re: mpn_sec_minvert name
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/ ___ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel
Re: mpn_sec_minvert name
Torbjorn Granlund writes: > My change to mpn_sec_invert is pending on your sec changes. I've now added sec_add_1 and sec_sub_1 (which I think are of some importantance for applications). I doubt I will have the needed time and energy for proper testing of assembly cnd_swap and cnd_neg before release, so don't wait for that. 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. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26. Internet email is subject to wholesale government surveillance. ___ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel
Re: mpn_sec_minvert name
ni...@lysator.liu.se (Niels Möller) writes: I was about to add a NEWS entry for mpn_sec_minvert, but we should decide the name. I'm not particularly attached to the current name. Torbjörn, you preferred mpn_sec_invert, for consistency with mpz_invert? My change to mpn_sec_invert is pending on your sec changes. (Go ahead and add an item, using the *current* name.) Torbjörn Please encrypt, key id 0xC8601622 ___ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel