[Gmp-commit] /var/hg/gmp: gmpxx.h: Special handling for mpq==0
mercurial at gmplib.org
mercurial at gmplib.org
Sat Mar 3 14:59:56 UTC 2018
details: /var/hg/gmp/rev/6e2eea21dce4
changeset: 17580:6e2eea21dce4
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Sat Mar 03 15:55:53 2018 +0100
description:
gmpxx.h: Special handling for mpq==0
diffstat:
gmpxx.h | 11 ++++++++---
tests/cxx/t-ops2qf.cc | 2 +-
2 files changed, 9 insertions(+), 4 deletions(-)
diffs (41 lines):
diff -r 2efd05ef991f -r 6e2eea21dce4 gmpxx.h
--- a/gmpxx.h Wed Feb 28 08:30:33 2018 +0100
+++ b/gmpxx.h Sat Mar 03 15:55:53 2018 +0100
@@ -1,6 +1,7 @@
/* gmpxx.h -- C++ class wrapper for GMP types. -*- C++ -*-
-Copyright 2001-2003, 2006, 2008, 2011-2015 Free Software Foundation, Inc.
+Copyright 2001-2003, 2006, 2008, 2011-2015, 2018 Free Software
+Foundation, Inc.
This file is part of the GNU MP Library.
@@ -981,11 +982,15 @@
{ return mpq_equal(q, r) != 0; }
static bool eval(mpq_srcptr q, unsigned long int l)
- { return mpz_cmp_ui(mpq_denref(q), 1) == 0 && mpz_cmp_ui(mpq_numref(q), l) == 0; }
+ { return ((__GMPXX_CONSTANT(l) && l == 0) ||
+ mpz_cmp_ui(mpq_denref(q), 1) == 0) &&
+ mpz_cmp_ui(mpq_numref(q), l) == 0; }
static bool eval(unsigned long int l, mpq_srcptr q)
{ return eval(q, l); }
static bool eval(mpq_srcptr q, signed long int l)
- { return mpz_cmp_ui(mpq_denref(q), 1) == 0 && mpz_cmp_si(mpq_numref(q), l) == 0; }
+ { return ((__GMPXX_CONSTANT(l) && l == 0) ||
+ mpz_cmp_ui(mpq_denref(q), 1) == 0) &&
+ mpz_cmp_si(mpq_numref(q), l) == 0; }
static bool eval(signed long int l, mpq_srcptr q)
{ return eval(q, l); }
static bool eval(mpq_srcptr q, double d)
diff -r 2efd05ef991f -r 6e2eea21dce4 tests/cxx/t-ops2qf.cc
--- a/tests/cxx/t-ops2qf.cc Wed Feb 28 08:30:33 2018 +0100
+++ b/tests/cxx/t-ops2qf.cc Sat Mar 03 15:55:53 2018 +0100
@@ -1,6 +1,6 @@
/* Test mp*_class operators and functions.
-Copyright 2011, 2012 Free Software Foundation, Inc.
+Copyright 2011, 2012, 2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library test suite.
More information about the gmp-commit
mailing list