summaryrefslogtreecommitdiff
path: root/cxx
diff options
context:
space:
mode:
authorMarc Glisse <marc.glisse@inria.fr>2012-06-23 01:07:33 +0200
committerMarc Glisse <marc.glisse@inria.fr>2012-06-23 01:07:33 +0200
commit4aa6c64925423c7e3953f8e7b6d40edcef91e9c6 (patch)
treea90885c6b28d980dd7fda7bd2eb1a851a00ed7e0 /cxx
parentddd1cbd976340e24748197a9c55cf55cc159dcb0 (diff)
downloadgmp-4aa6c64925423c7e3953f8e7b6d40edcef91e9c6.tar.gz
Declare members of numeric_limits so they are properly emitted when their use is not inlined.
Diffstat (limited to 'cxx')
-rw-r--r--cxx/Makefile.am2
-rw-r--r--cxx/limits.cc51
2 files changed, 52 insertions, 1 deletions
diff --git a/cxx/Makefile.am b/cxx/Makefile.am
index c4a42dce4..f60b4c98e 100644
--- a/cxx/Makefile.am
+++ b/cxx/Makefile.am
@@ -25,5 +25,5 @@ noinst_LTLIBRARIES = libcxx.la
endif
libcxx_la_SOURCES = \
- isfuns.cc ismpf.cc ismpq.cc ismpz.cc ismpznw.cc \
+ isfuns.cc ismpf.cc ismpq.cc ismpz.cc ismpznw.cc limits.cc \
osdoprnti.cc osfuns.cc osmpf.cc osmpq.cc osmpz.cc
diff --git a/cxx/limits.cc b/cxx/limits.cc
new file mode 100644
index 000000000..9b32df758
--- /dev/null
+++ b/cxx/limits.cc
@@ -0,0 +1,51 @@
+/* instantiation of numeric_limits specializations.
+
+Copyright 2012 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 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 Lesser General Public
+License for more details.
+
+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 "gmpxx.h"
+
+namespace std {
+#define GMPXX_INSTANTIATE_LIMITS(T) \
+ const bool numeric_limits<T>::is_specialized; \
+ const int numeric_limits<T>::digits; \
+ const int numeric_limits<T>::digits10; \
+ const int numeric_limits<T>::max_digits10; \
+ const bool numeric_limits<T>::is_signed; \
+ const bool numeric_limits<T>::is_integer; \
+ const bool numeric_limits<T>::is_exact; \
+ const int numeric_limits<T>::radix; \
+ const int numeric_limits<T>::min_exponent; \
+ const int numeric_limits<T>::min_exponent10; \
+ const int numeric_limits<T>::max_exponent; \
+ const int numeric_limits<T>::max_exponent10; \
+ const bool numeric_limits<T>::has_infinity; \
+ const bool numeric_limits<T>::has_quiet_NaN; \
+ const bool numeric_limits<T>::has_signaling_NaN; \
+ const float_denorm_style numeric_limits<T>::has_denorm; \
+ const bool numeric_limits<T>::has_denorm_loss; \
+ const bool numeric_limits<T>::is_iec559; \
+ const bool numeric_limits<T>::is_bounded; \
+ const bool numeric_limits<T>::is_modulo; \
+ const bool numeric_limits<T>::traps; \
+ const bool numeric_limits<T>::tinyness_before; \
+ const float_round_style numeric_limits<T>::round_style
+
+ GMPXX_INSTANTIATE_LIMITS(mpz_class);
+ GMPXX_INSTANTIATE_LIMITS(mpq_class);
+ GMPXX_INSTANTIATE_LIMITS(mpf_class);
+}