diff options
author | Niels Möller <nisse@lysator.liu.se> | 2013-04-04 11:07:31 +0200 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2013-04-04 11:07:31 +0200 |
commit | 0d039117d988ac5132c86f5fff3206a44db6f98f (patch) | |
tree | d3c93535cf39a096195695259e6e1f61762023f4 /gmp-glue.h | |
parent | 2d796c6e6807f27d5c1b49dbeb49deaa77c98b86 (diff) | |
download | nettle-0d039117d988ac5132c86f5fff3206a44db6f98f.tar.gz |
Use mpn_cnd_add_n and mpn_cnd_sub_n when available. Rearrange inclusions of gmp-glue.h.
Diffstat (limited to 'gmp-glue.h')
-rw-r--r-- | gmp-glue.h | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -50,6 +50,15 @@ #define gmp_alloc_limbs _nettle_gmp_alloc_limbs #define gmp_free_limbs _nettle_gmp_free_limbs +/* Use only in-place operations, so we can fall back to addmul_1/submul_1 */ +#ifdef mpn_cnd_add_n +# define cnd_add_n(cnd, rp, ap, n) mpn_cnd_add_n ((cnd), (rp), (rp), (ap), (n)) +# define cnd_sub_n(cnd, rp, ap, n) mpn_cnd_sub_n ((cnd), (rp), (rp), (ap), (n)) +#else +# define cnd_add_n(cnd, rp, ap, n) mpn_addmul_1 ((rp), (ap), (n), (cnd) != 0) +# define cnd_sub_n(cnd, rp, ap, n) mpn_submul_1 ((rp), (ap), (n), (cnd) != 0) +#endif + /* Some functions for interfacing between mpz and mpn code. Signs of the mpz numbers are generally ignored. */ |