[Gmp-commit] /var/hg/gmp: Make __GMPZ_ULI_LIMBS more preprocessor-friendly.
mercurial at gmplib.org
mercurial at gmplib.org
Tue Mar 15 19:23:34 CET 2011
details: /var/hg/gmp/rev/c1537591cbd9
changeset: 14065:c1537591cbd9
user: Marc Glisse <marc.glisse at inria.fr>
date: Tue Mar 15 19:22:57 2011 +0100
description:
Make __GMPZ_ULI_LIMBS more preprocessor-friendly.
diffstat:
ChangeLog | 3 +++
gmpxx.h | 10 ++++++++--
tests/cxx/t-ops2.cc | 1 +
3 files changed, 12 insertions(+), 2 deletions(-)
diffs (44 lines):
diff -r 65ebe713fc77 -r c1537591cbd9 ChangeLog
--- a/ChangeLog Tue Mar 15 11:16:47 2011 +0100
+++ b/ChangeLog Tue Mar 15 19:22:57 2011 +0100
@@ -5,6 +5,9 @@
(struct __gmp_binary_multiplies): Rewrite, using the new macros.
(struct __gmp_binary_divides): Likewise.
+ * gmpxx.h (__GMPZ_ULI_LIMBS): Rewrite.
+ * tests/cxx/t-ops2.cc: test converting ULONG_MIN to stack mpq_t.
+
2011-03-15 Marco Bodrato <bodrato at mail.dm.unipi.it>
* mpn/generic/toom_interpolate_16pts.c: Remove ambiguity.
diff -r 65ebe713fc77 -r c1537591cbd9 gmpxx.h
--- a/gmpxx.h Tue Mar 15 11:16:47 2011 +0100
+++ b/gmpxx.h Tue Mar 15 19:22:57 2011 +0100
@@ -42,8 +42,14 @@
// Max allocations for plain types when converted to mpz_t
#define __GMPZ_DBL_LIMBS (2 + DBL_MAX_EXP / GMP_NUMB_BITS)
-#define __GMPZ_ULI_LIMBS (1 + (8 * sizeof (long) - 1) / GMP_NUMB_BITS)
-
+
+#if GMP_NAIL_BITS != 0 && ! defined _LONG_LONG_LIMB
+#define __GMPZ_ULI_LIMBS 2
+#else
+#define __GMPZ_ULI_LIMBS 1
+#endif
+
+// Fake temporary variables
#define __GMPXX_TMPZ_UI \
mpz_t temp; \
mp_limb_t limbs[__GMPZ_ULI_LIMBS]; \
diff -r 65ebe713fc77 -r c1537591cbd9 tests/cxx/t-ops2.cc
--- a/tests/cxx/t-ops2.cc Tue Mar 15 11:16:47 2011 +0100
+++ b/tests/cxx/t-ops2.cc Tue Mar 15 19:22:57 2011 +0100
@@ -135,6 +135,7 @@
CHECK_ALL_SIGNS(T,11.,3,-);
CHECK_ALL_SIGNS(T,11.,3,*);
CHECK_ALL_SIGNS(T,11.,4,/);
+ CHECK_SI(T,LONG_MIN,1,*);
CHECK_ALL_COMPARISONS(T,5.,2);
CHECK_ALL_SIGNS_COMPARISONS(T,11.,3);
CHECK_MPZ(T,5,-2,<);
More information about the gmp-commit
mailing list