[Gmp-commit] /home/hgfiles/gmp-5.0: 2 new changesets
mercurial at gmplib.org
mercurial at gmplib.org
Tue Feb 23 22:28:26 CET 2010
details: /home/hgfiles/gmp-5.0/rev/69aa06eea4cf
changeset: 13425:69aa06eea4cf
user: Torbjorn Granlund <tege at gmplib.org>
date: Tue Feb 23 22:27:56 2010 +0100
description:
Use CNST_LIMB.
details: /home/hgfiles/gmp-5.0/rev/dff71729341d
changeset: 13426:dff71729341d
user: Torbjorn Granlund <tege at gmplib.org>
date: Tue Feb 23 22:28:22 2010 +0100
description:
Cast a switch index.
diffstat:
ChangeLog | 6 ++++++
mpn/generic/mod_1_3.c | 7 ++++---
mpn/generic/sqrtrem.c | 10 +++++-----
3 files changed, 15 insertions(+), 8 deletions(-)
diffs (72 lines):
diff -r 582a938fa2a4 -r dff71729341d ChangeLog
--- a/ChangeLog Sun Feb 07 23:03:45 2010 +0100
+++ b/ChangeLog Tue Feb 23 22:28:22 2010 +0100
@@ -1,3 +1,9 @@
+2010-02-23 Torbjorn Granlund <tege at gmplib.org>
+
+ * mpn/generic/mod_1_3.c: Cast a switch index.
+
+ * mpn/generic/sqrtrem.c: Use CNST_LIMB.
+
2010-02-07 Torbjorn Granlund <tege at gmplib.org>
* tune/tuneup.c (tune_redc): Set min_size and min_is_always when
diff -r 582a938fa2a4 -r dff71729341d mpn/generic/mod_1_3.c
--- a/mpn/generic/mod_1_3.c Sun Feb 07 23:03:45 2010 +0100
+++ b/mpn/generic/mod_1_3.c Tue Feb 23 22:28:22 2010 +0100
@@ -8,7 +8,7 @@
SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-Copyright 2008, 2009 Free Software Foundation, Inc.
+Copyright 2008, 2009, 2010 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -85,8 +85,9 @@
B4modb = cps[5];
/* We compute n mod 3 in a tricky way, which works except for when n is so
- close to the maximum size that we don't need to support it. */
- switch ((mp_limb_t) n * MODLIMB_INVERSE_3 >> (GMP_NUMB_BITS - 2))
+ close to the maximum size that we don't need to support it. The final
+ cast to int is a workaround for HP cc. */
+ switch ((int) ((mp_limb_t) n * MODLIMB_INVERSE_3 >> (GMP_NUMB_BITS - 2)))
{
case 0:
umul_ppmm (ph, pl, ap[n - 2], B1modb);
diff -r 582a938fa2a4 -r dff71729341d mpn/generic/sqrtrem.c
--- a/mpn/generic/sqrtrem.c Sun Feb 07 23:03:45 2010 +0100
+++ b/mpn/generic/sqrtrem.c Tue Feb 23 22:28:22 2010 +0100
@@ -8,8 +8,8 @@
INTERFACES. IN FACT, IT IS ALMOST GUARANTEED THAT THEY WILL CHANGE OR
DISAPPEAR IN A FUTURE GMP RELEASE.
-Copyright 1999, 2000, 2001, 2002, 2004, 2005, 2008 Free Software Foundation,
-Inc.
+Copyright 1999, 2000, 2001, 2002, 2004, 2005, 2008, 2010 Free Software
+Foundation, Inc.
This file is part of the GNU MP Library.
@@ -92,9 +92,9 @@
/* Compute s = floor(sqrt(a0)), and *rp = a0 - s^2. */
#if GMP_NUMB_BITS > 32
-#define MAGIC 0x10000000000 /* 0xffe7debbfc < MAGIC < 0x232b1850f410 */
+#define MAGIC CNST_LIMB(0x10000000000) /* 0xffe7debbfc < MAGIC < 0x232b1850f410 */
#else
-#define MAGIC 0x100000 /* 0xfee6f < MAGIC < 0x29cbc8 */
+#define MAGIC CNST_LIMB(0x100000) /* 0xfee6f < MAGIC < 0x29cbc8 */
#endif
static mp_limb_t
@@ -121,7 +121,7 @@
#if GMP_NUMB_BITS > 32
a1 = a0 >> (GMP_LIMB_BITS - 1 - 32);
- t = (mp_limb_signed_t) (0x2000000000000l - 0x30000 - a1 * x0 * x0) >> 16;
+ t = (mp_limb_signed_t) (CNST_LIMB(0x2000000000000) - 0x30000 - a1 * x0 * x0) >> 16;
x0 = (x0 << 16) + ((mp_limb_signed_t) (x0 * t) >> (16+2));
/* x0 is now an 16 bits approximation of 1/sqrt(a0) */
More information about the gmp-commit
mailing list