=================================================================== RCS file: /home/cvs/OpenXM_contrib/gmp/mpn/generic/Attic/dump.c,v retrieving revision 1.1.1.2 retrieving revision 1.1.1.3 diff -u -p -r1.1.1.2 -r1.1.1.3 --- OpenXM_contrib/gmp/mpn/generic/Attic/dump.c 2000/09/09 14:12:24 1.1.1.2 +++ OpenXM_contrib/gmp/mpn/generic/Attic/dump.c 2003/08/25 16:06:20 1.1.1.3 @@ -3,7 +3,7 @@ FUNCTION WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. -Copyright (C) 1996, 2000 Free Software Foundation, Inc. +Copyright 1996, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -27,50 +27,66 @@ MA 02111-1307, USA. #include "gmp.h" #include "gmp-impl.h" +#if GMP_NUMB_BITS % 4 == 0 void -#if __STDC__ -mpn_dump (mp_srcptr ptr, mp_size_t size) -#else -mpn_dump (ptr, size) - mp_srcptr ptr; - mp_size_t size; -#endif +mpn_dump (mp_srcptr ptr, mp_size_t n) { - MPN_NORMALIZE (ptr, size); + MPN_NORMALIZE (ptr, n); - if (size == 0) + if (n == 0) printf ("0\n"); else { - size--; - if (BYTES_PER_MP_LIMB > sizeof (long)) + n--; +#if _LONG_LONG_LIMB + if ((ptr[n] >> GMP_LIMB_BITS / 2) != 0) { - if ((ptr[size] >> BITS_PER_MP_LIMB/2) != 0) - { - printf ("%lX", - (unsigned long) (ptr[size] >> BITS_PER_MP_LIMB/2)); - printf ("%0*lX", (int) (BYTES_PER_MP_LIMB), - (unsigned long) ptr[size]); - } - else - printf ("%lX", (unsigned long) ptr[size]); + printf ("%lX", (unsigned long) (ptr[n] >> GMP_LIMB_BITS / 2)); + printf ("%0*lX", (GMP_LIMB_BITS / 2 / 4), (unsigned long) ptr[n]); } else - printf ("%lX", ptr[size]); +#endif + printf ("%lX", (unsigned long) ptr[n]); - while (size) + while (n) { - size--; - if (BYTES_PER_MP_LIMB > sizeof (long)) - { - printf ("%0*lX", (int) (BYTES_PER_MP_LIMB), - (unsigned long) (ptr[size] >> BITS_PER_MP_LIMB/2)); - printf ("%0*lX", (int) (BYTES_PER_MP_LIMB), - (unsigned long) ptr[size]); - } - else - printf ("%0*lX", (int) (2 * BYTES_PER_MP_LIMB), ptr[size]); + n--; +#if _LONG_LONG_LIMB + printf ("%0*lX", (GMP_NUMB_BITS - GMP_LIMB_BITS / 2) / 4, + (unsigned long) (ptr[n] >> GMP_LIMB_BITS / 2)); + printf ("%0*lX", GMP_LIMB_BITS / 2 / 4, (unsigned long) ptr[n]); +#else + printf ("%0*lX", GMP_NUMB_BITS / 4, (unsigned long) ptr[n]); +#endif } printf ("\n"); } } + +#else + +static void +mpn_recdump (mp_ptr p, mp_size_t n) +{ + mp_limb_t lo; + if (n != 0) + { + lo = p[0] & 0xf; + mpn_rshift (p, p, n, 4); + mpn_recdump (p, n); + printf ("%lX", lo); + } +} + +void +mpn_dump (mp_srcptr p, mp_size_t n) +{ + mp_ptr tp; + TMP_DECL (marker); + TMP_MARK (marker); + tp = TMP_ALLOC_LIMBS (n); + MPN_COPY (tp, p, n); + TMP_FREE (marker); +} + +#endif