summaryrefslogtreecommitdiff
path: root/gmp/mpq/cmp_si.c
diff options
context:
space:
mode:
Diffstat (limited to 'gmp/mpq/cmp_si.c')
-rw-r--r--gmp/mpq/cmp_si.c41
1 files changed, 15 insertions, 26 deletions
diff --git a/gmp/mpq/cmp_si.c b/gmp/mpq/cmp_si.c
index 0a31fe8c9e..a744a98429 100644
--- a/gmp/mpq/cmp_si.c
+++ b/gmp/mpq/cmp_si.c
@@ -1,32 +1,21 @@
/* _mpq_cmp_si -- compare mpq and long/ulong fraction.
-Copyright 2001, 2013 Free Software Foundation, Inc.
+Copyright 2001 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
The GNU MP Library is free software; you can redistribute it and/or modify
-it under the terms of either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
The GNU MP Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
-You should have received copies of the GNU General Public License and the
-GNU Lesser General Public License along with the GNU MP Library. If not,
-see https://www.gnu.org/licenses/. */
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
#include "gmp.h"
#include "gmp-impl.h"
@@ -40,9 +29,9 @@ int
_mpq_cmp_si (mpq_srcptr q, long n, unsigned long d)
{
/* need canonical sign to get right result */
- ASSERT (SIZ(DEN(q)) > 0);
+ ASSERT (q->_mp_den._mp_size > 0);
- if (SIZ(NUM(q)) >= 0)
+ if (q->_mp_num._mp_size >= 0)
{
if (n >= 0)
return _mpq_cmp_ui (q, n, d); /* >=0 cmp >=0 */
@@ -56,12 +45,12 @@ _mpq_cmp_si (mpq_srcptr q, long n, unsigned long d)
else
{
mpq_t qabs;
- SIZ(NUM(qabs)) = ABSIZ(NUM(q));
- PTR(NUM(qabs)) = PTR(NUM(q));
- SIZ(DEN(qabs)) = SIZ(DEN(q));
- PTR(DEN(qabs)) = PTR(DEN(q));
+ qabs->_mp_num._mp_size = ABS (q->_mp_num._mp_size);
+ qabs->_mp_num._mp_d = q->_mp_num._mp_d;
+ qabs->_mp_den._mp_size = q->_mp_den._mp_size;
+ qabs->_mp_den._mp_d = q->_mp_den._mp_d;
- return - _mpq_cmp_ui (qabs, NEG_CAST (unsigned long, n), d); /* <0 cmp <0 */
+ return - _mpq_cmp_ui (qabs, -n, d); /* <0 cmp <0 */
}
}
}