[BACK]Return to cmp.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / gmp / mpz

Annotation of OpenXM_contrib/gmp/mpz/cmp.c, Revision 1.1.1.3

1.1       maekawa     1: /* mpz_cmp(u,v) -- Compare U, V.  Return postive, zero, or negative
                      2:    based on if U > V, U == V, or U < V.
                      3:
1.1.1.3 ! ohara       4: Copyright 1991, 1993, 1994, 1996, 2001 Free Software Foundation, Inc.
1.1       maekawa     5:
                      6: This file is part of the GNU MP Library.
                      7:
                      8: The GNU MP Library is free software; you can redistribute it and/or modify
1.1.1.2   maekawa     9: it under the terms of the GNU Lesser General Public License as published by
                     10: the Free Software Foundation; either version 2.1 of the License, or (at your
1.1       maekawa    11: option) any later version.
                     12:
                     13: The GNU MP Library is distributed in the hope that it will be useful, but
                     14: WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1.1.1.2   maekawa    15: or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
1.1       maekawa    16: License for more details.
                     17:
1.1.1.2   maekawa    18: You should have received a copy of the GNU Lesser General Public License
1.1       maekawa    19: along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
                     20: the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
                     21: MA 02111-1307, USA. */
                     22:
                     23: #ifdef BERKELEY_MP
                     24: #include "mp.h"
                     25: #endif
                     26: #include "gmp.h"
                     27: #include "gmp-impl.h"
                     28:
                     29: int
1.1.1.3 ! ohara      30: #ifdef BERKELEY_MP
1.1       maekawa    31: mcmp (mpz_srcptr u, mpz_srcptr v)
                     32: #else
1.1.1.3 ! ohara      33: mpz_cmp (mpz_srcptr u, mpz_srcptr v)
1.1       maekawa    34: #endif
                     35: {
1.1.1.3 ! ohara      36:   mp_size_t  usize, vsize, dsize, asize;
        !            37:   mp_srcptr  up, vp;
        !            38:   int        cmp;
        !            39:
        !            40:   usize = SIZ(u);
        !            41:   vsize = SIZ(v);
        !            42:   dsize = usize - vsize;
        !            43:   if (dsize != 0)
        !            44:     return dsize;
        !            45:
        !            46:   asize = ABS (usize);
        !            47:   up = PTR(u);
        !            48:   vp = PTR(v);
        !            49:   MPN_CMP (cmp, up, vp, asize);
        !            50:   return (usize >= 0 ? cmp : -cmp);
1.1       maekawa    51: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>