diff options
author | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2015-07-01 23:07:48 +0200 |
---|---|---|
committer | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2015-07-01 23:07:48 +0200 |
commit | e65f55f37f24d598e25ac8dafa0482ac5f786b86 (patch) | |
tree | cbe53afc1681805b9222db4376ace3d4d2f6a93a /gmp-impl.h | |
parent | 0c97bc9f87536a0fa7e764f7e503d379ab2a943a (diff) | |
download | gmp-e65f55f37f24d598e25ac8dafa0482ac5f786b86.tar.gz |
gmp-impl.h (MPN_FILL): New macro.
Diffstat (limited to 'gmp-impl.h')
-rw-r--r-- | gmp-impl.h | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/gmp-impl.h b/gmp-impl.h index 68eb629c1..b5f8b05fb 100644 --- a/gmp-impl.h +++ b/gmp-impl.h @@ -1825,35 +1825,35 @@ __GMP_DECLSPEC void mpn_copyd (mp_ptr, mp_srcptr, mp_size_t); would be good when on a GNU system. */ #if HAVE_HOST_CPU_FAMILY_power || HAVE_HOST_CPU_FAMILY_powerpc -#define MPN_ZERO(dst, n) \ +#define MPN_FILL(dst, n, f) \ do { \ - ASSERT ((n) >= 0); \ - if ((n) != 0) \ - { \ - mp_ptr __dst = (dst) - 1; \ - mp_size_t __n = (n); \ - do \ - *++__dst = 0; \ - while (--__n); \ - } \ + mp_ptr __dst = (dst) - 1; \ + mp_size_t __n = (n); \ + ASSERT (__n > 0); \ + do \ + *++__dst = (f); \ + while (--__n); \ + } while (0) +#endif + +#ifndef MPN_FILL +#define MPN_FILL(dst, n, f) \ + do { \ + mp_ptr __dst = (dst); \ + mp_size_t __n = (n); \ + ASSERT (__n > 0); \ + do \ + *__dst++ = (f); \ + while (--__n); \ } while (0) #endif -#ifndef MPN_ZERO #define MPN_ZERO(dst, n) \ do { \ ASSERT ((n) >= 0); \ if ((n) != 0) \ - { \ - mp_ptr __dst = (dst); \ - mp_size_t __n = (n); \ - do \ - *__dst++ = 0; \ - while (--__n); \ - } \ + MPN_FILL (dst, n, CNST_LIMB (0)); \ } while (0) -#endif - /* On the x86s repe/scasl doesn't seem useful, since it takes many cycles to start up and would need to strip a lot of zeros before it'd be faster |