diff options
author | Kevin Ryde <user42@zip.com.au> | 2001-07-23 22:50:10 +0200 |
---|---|---|
committer | Kevin Ryde <user42@zip.com.au> | 2001-07-23 22:50:10 +0200 |
commit | 16c0bbc3ad5407dc42be081a8d6a4758c8f59476 (patch) | |
tree | f12cda0ee5c942342be754bd8f1e160d8f7466ba /gmp-impl.h | |
parent | 8fe778704041bce083921091cea6553c94d143cf (diff) | |
download | gmp-16c0bbc3ad5407dc42be081a8d6a4758c8f59476.tar.gz |
* gmp-impl.h (__GMP_REALLOCATE_FUNC_MAYBE): New macro.
* gmp-impl.h (mpn_fib2_ui): Use __MPN.
(MPN_COPY_DECR): Fix an ASSERT.
(CAST_TO_VOID): Remove macro.
CAST_TO_VOID was a dumb idea, everywhere else uses void unconditionally.
Diffstat (limited to 'gmp-impl.h')
-rw-r--r-- | gmp-impl.h | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/gmp-impl.h b/gmp-impl.h index 80d03be4b..ccb264e05 100644 --- a/gmp-impl.h +++ b/gmp-impl.h @@ -398,6 +398,12 @@ void __gmp_default_free _PROTO ((void *, size_t)); #define __GMP_FREE_FUNC_TYPE(p,n,type) (*__gmp_free_func) (p, (n) * sizeof (type)) #define __GMP_FREE_FUNC_LIMBS(p,n) __GMP_FREE_FUNC_TYPE (p, n, mp_limb_t) +#define __GMP_REALLOCATE_FUNC_MAYBE(ptr, oldsize, newsize) \ + do { \ + if ((oldsize) != (newsize)) \ + (ptr) = (*__gmp_reallocate_func) (ptr, oldsize, newsize); \ + } while (0) + /* const and signed must match __gmp_const and __gmp_signed, so follow the decision made for those in gmp.h. */ @@ -468,7 +474,7 @@ void __gmp_default_free _PROTO ((void *, size_t)); void __gmpz_aorsmul_1 _PROTO ((REGPARM_3_1 (mpz_ptr w, mpz_srcptr u, mp_limb_t v, mp_size_t sub))) REGPARM_ATTR(1); #define mpz_aorsmul_1(w,u,v,sub) __gmpz_aorsmul_1 (REGPARM_3_1 (w, u, v, sub)) -#define mpn_fib2_ui __gmpn_fib2_ui +#define mpn_fib2_ui __MPN(fib2_ui) mp_size_t mpn_fib2_ui _PROTO ((mp_ptr, mp_ptr, unsigned long)); /* Remap names of internal mpn functions. */ @@ -637,14 +643,13 @@ void mpn_copyd _PROTO ((mp_ptr, mp_srcptr, mp_size_t)); #define MPN_COPY_DECR(dst, src, size) \ do { \ ASSERT ((size) >= 0); \ - ASSERT (MPN_SAME_OR_INCR_P (dst, src, size)); \ + ASSERT (MPN_SAME_OR_DECR_P (dst, src, size)); \ mpn_copyd (dst, src, size); \ } while (0) -#else - +#endif /* NLIMBS==0 allowed */ -#ifndef MPN_COPY_DECR +#if ! defined (MPN_COPY_DECR) #define MPN_COPY_DECR(DST, SRC, NLIMBS) \ do { \ mp_size_t __i; \ @@ -654,7 +659,7 @@ void mpn_copyd _PROTO ((mp_ptr, mp_srcptr, mp_size_t)); (DST)[__i] = (SRC)[__i]; \ } while (0) #endif -#endif + /* Define MPN_COPY for vector computers. Since #pragma cannot be in a macro, rely on function inlining. @@ -996,13 +1001,6 @@ extern const mp_limb_t __gmp_fib_table[]; MPN_SAME_OR_DECR2_P(dst, size, src, size) -#if HAVE_VOID -#define CAST_TO_VOID (void) -#else -#define CAST_TO_VOID -#endif - - /* ASSERT() is a private assertion checking scheme, similar to <assert.h>. ASSERT() does the check only if WANT_ASSERT is selected, ASSERT_ALWAYS() does it always. Generally assertions are meant for development, but |