Commit 33304507 authored by Niels Möller's avatar Niels Möller
Browse files

Make gmp-glue.c work in the case that GMP does define mpz_limbs_read and friends.

parent ae944d88
2013-03-07 Niels Möller <nisse@lysator.liu.se> 2013-03-07 Niels Möller <nisse@lysator.liu.se>
* gmp-glue.c (mpz_limbs_cmp): Don't use PTR and SIZ macros.
* Makefile.in (aesdata, desdata, twofishdata, shadata, gcmdata) * Makefile.in (aesdata, desdata, twofishdata, shadata, gcmdata)
(eccdata): Arrange for compiling these programs for running on the (eccdata): Arrange for compiling these programs for running on the
build system, also when cross compiling everything else. build system, also when cross compiling everything else.
......
...@@ -111,7 +111,10 @@ mpz_roinit_n (mpz_ptr x, const mp_limb_t *xp, mp_size_t xs) ...@@ -111,7 +111,10 @@ mpz_roinit_n (mpz_ptr x, const mp_limb_t *xp, mp_size_t xs)
int int
mpz_limbs_cmp (mpz_srcptr a, const mp_limb_t *bp, mp_size_t bn) 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) if (an < bn)
return -1; return -1;
if (an > bn) if (an > bn)
...@@ -119,7 +122,7 @@ mpz_limbs_cmp (mpz_srcptr a, const mp_limb_t *bp, mp_size_t bn) ...@@ -119,7 +122,7 @@ mpz_limbs_cmp (mpz_srcptr a, const mp_limb_t *bp, mp_size_t bn)
if (an == 0) if (an == 0)
return 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 /* Get a pointer to an n limb area, for read-only operation. n must be
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment