From: Niels Möller Date: Thu, 7 Mar 2013 14:10:54 +0000 (+0100) Subject: Make gmp-glue.c work in the case that GMP does define mpz_limbs_read and friends. X-Git-Tag: nettle_2.7_release_20130424~109^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fheads%2Fecc-support;p=thirdparty%2Fnettle.git Make gmp-glue.c work in the case that GMP does define mpz_limbs_read and friends. --- diff --git a/ChangeLog b/ChangeLog index afa886e2..bb7e07e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2013-03-07 Niels Möller + * gmp-glue.c (mpz_limbs_cmp): Don't use PTR and SIZ macros. + * Makefile.in (aesdata, desdata, twofishdata, shadata, gcmdata) (eccdata): Arrange for compiling these programs for running on the build system, also when cross compiling everything else. diff --git a/gmp-glue.c b/gmp-glue.c index 85b6beda..b468699b 100644 --- a/gmp-glue.c +++ b/gmp-glue.c @@ -111,7 +111,10 @@ mpz_roinit_n (mpz_ptr x, const mp_limb_t *xp, mp_size_t xs) int mpz_limbs_cmp (mpz_srcptr a, const mp_limb_t *bp, mp_size_t bn) { - mp_size_t an = SIZ (a); + mp_size_t an = mpz_size (a); + assert (mpz_sgn (a) >= 0); + assert (bn >= 0); + if (an < bn) return -1; if (an > bn) @@ -119,7 +122,7 @@ mpz_limbs_cmp (mpz_srcptr a, const mp_limb_t *bp, mp_size_t bn) if (an == 0) return 0; - return mpn_cmp (PTR(a), bp, an); + return mpn_cmp (mpz_limbs_read(a), bp, an); } /* Get a pointer to an n limb area, for read-only operation. n must be