[Gmp-commit] /home/hgfiles/gmp: 2 new changesets
mercurial at gmplib.org
mercurial at gmplib.org
Tue Feb 23 22:23:24 CET 2010
details: /home/hgfiles/gmp/rev/ad766fca5d09
changeset: 13434:ad766fca5d09
user: Torbjorn Granlund <tege at gmplib.org>
date: Tue Feb 23 22:21:57 2010 +0100
description:
Use CNST_LIMB.
details: /home/hgfiles/gmp/rev/022da605476f
changeset: 13435:022da605476f
user: Torbjorn Granlund <tege at gmplib.org>
date: Tue Feb 23 22:23:18 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 d0223fefc57e -r 022da605476f ChangeLog
--- a/ChangeLog Sat Feb 20 20:44:12 2010 +0100
+++ b/ChangeLog Tue Feb 23 22:23:18 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-20 Niels Möller <nisse at lysator.liu.se>
* tune/speed.h (mpn_gcd_accel): Deleted prototype.
diff -r d0223fefc57e -r 022da605476f mpn/generic/mod_1_3.c
--- a/mpn/generic/mod_1_3.c Sat Feb 20 20:44:12 2010 +0100
+++ b/mpn/generic/mod_1_3.c Tue Feb 23 22:23:18 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 d0223fefc57e -r 022da605476f mpn/generic/sqrtrem.c
--- a/mpn/generic/sqrtrem.c Sat Feb 20 20:44:12 2010 +0100
+++ b/mpn/generic/sqrtrem.c Tue Feb 23 22:23:18 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