[Gmp-commit] /var/hg/gmp: Get rid of BYTES_PER_MP_LIMB, most files affected.
mercurial at gmplib.org
mercurial at gmplib.org
Sun Jan 19 12:25:08 UTC 2014
details: /var/hg/gmp/rev/84d5467c199f
changeset: 16221:84d5467c199f
user: Torbjorn Granlund <tege at gmplib.org>
date: Sun Jan 19 13:25:03 2014 +0100
description:
Get rid of BYTES_PER_MP_LIMB, most files affected.
diffstat:
ChangeLog | 2 ++
gmp-impl.h | 9 ++++-----
memory.c | 20 ++++++++++----------
mpf/clear.c | 2 +-
mpf/clears.c | 2 +-
mpf/init.c | 2 +-
mpf/init2.c | 2 +-
mpf/iset.c | 2 +-
mpf/iset_d.c | 2 +-
mpf/iset_si.c | 2 +-
mpf/iset_str.c | 2 +-
mpf/iset_ui.c | 2 +-
mpn/alpha/ev5/gmp-mparam.h | 2 +-
mpn/alpha/ev6/gmp-mparam.h | 2 +-
mpn/alpha/ev6/nails/gmp-mparam.h | 2 +-
mpn/alpha/gmp-mparam.h | 2 +-
mpn/arm/gmp-mparam.h | 2 +-
mpn/arm/v6/gmp-mparam.h | 2 +-
mpn/arm/v7a/cora15/gmp-mparam.h | 2 +-
mpn/arm/v7a/cora9/gmp-mparam.h | 2 +-
mpn/asm-defs.m4 | 12 ++++++------
mpn/cray/gmp-mparam.h | 2 +-
mpn/cray/ieee/gmp-mparam.h | 2 +-
mpn/generic/add_n_sub_n.c | 10 +++++-----
mpn/ia64/gmp-mparam.h | 2 +-
mpn/m68k/gmp-mparam.h | 2 +-
mpn/mips32/gmp-mparam.h | 2 +-
mpn/mips64/gmp-mparam.h | 2 +-
mpn/pa32/gmp-mparam.h | 2 +-
mpn/pa32/hppa1_1/gmp-mparam.h | 2 +-
mpn/pa32/hppa2_0/gmp-mparam.h | 2 +-
mpn/pa64/gmp-mparam.h | 2 +-
mpn/powerpc32/750/gmp-mparam.h | 2 +-
mpn/powerpc32/gmp-mparam.h | 2 +-
mpn/powerpc32/p3/gmp-mparam.h | 2 +-
mpn/powerpc32/p5/gmp-mparam.h | 2 +-
mpn/powerpc32/p6/gmp-mparam.h | 2 +-
mpn/powerpc32/p7/gmp-mparam.h | 2 +-
mpn/powerpc64/mode64/gmp-mparam.h | 2 +-
mpn/powerpc64/mode64/p3/gmp-mparam.h | 2 +-
mpn/powerpc64/mode64/p4/gmp-mparam.h | 2 +-
mpn/powerpc64/mode64/p5/gmp-mparam.h | 2 +-
mpn/powerpc64/mode64/p6/gmp-mparam.h | 2 +-
mpn/powerpc64/mode64/p7/gmp-mparam.h | 2 +-
mpn/s390_32/esame/gmp-mparam.h | 2 +-
mpn/s390_32/gmp-mparam.h | 2 +-
mpn/s390_64/gmp-mparam.h | 2 +-
mpn/s390_64/z10/gmp-mparam.h | 2 +-
mpn/sparc32/v8/gmp-mparam.h | 2 +-
mpn/sparc32/v8/supersparc/gmp-mparam.h | 2 +-
mpn/sparc32/v9/gmp-mparam.h | 2 +-
mpn/sparc64/gmp-mparam.h | 2 +-
mpn/sparc64/ultrasparc34/gmp-mparam.h | 2 +-
mpn/sparc64/ultrasparct1/gmp-mparam.h | 2 +-
mpn/x86/atom/gmp-mparam.h | 2 +-
mpn/x86/bobcat/gmp-mparam.h | 2 +-
mpn/x86/core2/gmp-mparam.h | 2 +-
mpn/x86/coreinhm/gmp-mparam.h | 2 +-
mpn/x86/coreisbr/gmp-mparam.h | 2 +-
mpn/x86/fat/gmp-mparam.h | 2 +-
mpn/x86/geode/gmp-mparam.h | 2 +-
mpn/x86/gmp-mparam.h | 2 +-
mpn/x86/i486/gmp-mparam.h | 2 +-
mpn/x86/k10/gmp-mparam.h | 2 +-
mpn/x86/k6/gmp-mparam.h | 2 +-
mpn/x86/k7/gmp-mparam.h | 2 +-
mpn/x86/k8/gmp-mparam.h | 2 +-
mpn/x86/nano/gmp-mparam.h | 2 +-
mpn/x86/p6/gmp-mparam.h | 2 +-
mpn/x86/p6/mmx/gmp-mparam.h | 2 +-
mpn/x86/p6/sse2/gmp-mparam.h | 2 +-
mpn/x86/pentium/gmp-mparam.h | 2 +-
mpn/x86/pentium/mmx/gmp-mparam.h | 2 +-
mpn/x86/pentium4/sse2/gmp-mparam.h | 2 +-
mpn/x86/x86-defs.m4 | 2 +-
mpn/x86_64/atom/gmp-mparam.h | 2 +-
mpn/x86_64/bd1/gmp-mparam.h | 2 +-
mpn/x86_64/bobcat/gmp-mparam.h | 2 +-
mpn/x86_64/core2/gmp-mparam.h | 2 +-
mpn/x86_64/coreihwl/gmp-mparam.h | 2 +-
mpn/x86_64/coreinhm/gmp-mparam.h | 2 +-
mpn/x86_64/coreisbr/gmp-mparam.h | 2 +-
mpn/x86_64/fat/gmp-mparam.h | 2 +-
mpn/x86_64/gmp-mparam.h | 2 +-
mpn/x86_64/k10/gmp-mparam.h | 2 +-
mpn/x86_64/k8/gmp-mparam.h | 2 +-
mpn/x86_64/nano/gmp-mparam.h | 2 +-
mpn/x86_64/pentium4/gmp-mparam.h | 2 +-
mpn/z8000/gmp-mparam.h | 2 +-
mpq/clear.c | 4 ++--
mpq/clears.c | 4 ++--
mpq/get_d.c | 2 +-
mpq/init.c | 4 ++--
mpz/array_init.c | 2 +-
mpz/clear.c | 2 +-
mpz/clears.c | 2 +-
mpz/init.c | 2 +-
mpz/inp_raw.c | 2 +-
mpz/iset.c | 2 +-
mpz/iset_d.c | 2 +-
mpz/iset_si.c | 2 +-
mpz/iset_str.c | 2 +-
mpz/iset_ui.c | 4 ++--
mpz/mul.c | 4 ++--
mpz/out_raw.c | 10 +++++-----
rand/randmt.c | 6 +++---
tests/devel/addsub_n_2.c | 12 ++++++------
tests/devel/try.c | 12 ++++++------
tests/devel/tst-addsub.c | 8 ++++----
tests/refmpn.c | 10 +++++-----
tests/t-constants.c | 2 +-
tune/common.c | 14 +++++++-------
tune/speed.h | 10 +++++-----
tune/tuneup.c | 2 +-
114 files changed, 174 insertions(+), 173 deletions(-)
diffs (truncated from 1687 to 300 lines):
diff -r 97cf62067b72 -r 84d5467c199f ChangeLog
--- a/ChangeLog Sun Jan 19 13:11:06 2014 +0100
+++ b/ChangeLog Sun Jan 19 13:25:03 2014 +0100
@@ -1,5 +1,7 @@
2014-01-19 Torbjorn Granlund <tege at gmplib.org>
+ * Get rid of BYTES_PER_MP_LIMB, most files affected.
+
* mpz/iset.c: Avoid overflow in allocation computation.
* mpz/mul.c: Likewise.
* mpf/init.c: Likewise.
diff -r 97cf62067b72 -r 84d5467c199f gmp-impl.h
--- a/gmp-impl.h Sun Jan 19 13:11:06 2014 +0100
+++ b/gmp-impl.h Sun Jan 19 13:25:03 2014 +0100
@@ -206,10 +206,9 @@
/* if not provided by gmp-mparam.h */
-#ifndef BYTES_PER_MP_LIMB
-#define BYTES_PER_MP_LIMB SIZEOF_MP_LIMB_T
-#endif
-#define GMP_LIMB_BYTES BYTES_PER_MP_LIMB
+#ifndef GMP_LIMB_BYTES
+#define GMP_LIMB_BYTES SIZEOF_MP_LIMB_T
+#endif
#ifndef GMP_LIMB_BITS
#define GMP_LIMB_BITS (8 * SIZEOF_MP_LIMB_T)
#endif
@@ -3481,7 +3480,7 @@
mp_limb_t __bswapl_src = (src); \
mp_limb_t __dstl = 0; \
int __i; \
- for (__i = 0; __i < BYTES_PER_MP_LIMB; __i++) \
+ for (__i = 0; __i < GMP_LIMB_BYTES; __i++) \
{ \
__dstl = (__dstl << 8) | (__bswapl_src & 0xFF); \
__bswapl_src >>= 8; \
diff -r 97cf62067b72 -r 84d5467c199f memory.c
--- a/memory.c Sun Jan 19 13:11:06 2014 +0100
+++ b/memory.c Sun Jan 19 13:25:03 2014 +0100
@@ -38,7 +38,7 @@
void *ret;
#ifdef DEBUG
size_t req_size = size;
- size += 2 * BYTES_PER_MP_LIMB;
+ size += 2 * GMP_LIMB_BYTES;
#endif
ret = malloc (size);
if (ret == 0)
@@ -52,8 +52,8 @@
mp_ptr p = ret;
p++;
p[-1] = (0xdeadbeef << 31) + 0xdeafdeed;
- if (req_size % BYTES_PER_MP_LIMB == 0)
- p[req_size / BYTES_PER_MP_LIMB] = ~((0xdeadbeef << 31) + 0xdeafdeed);
+ if (req_size % GMP_LIMB_BYTES == 0)
+ p[req_size / GMP_LIMB_BYTES] = ~((0xdeadbeef << 31) + 0xdeafdeed);
ret = p;
}
#endif
@@ -76,8 +76,8 @@
fprintf (stderr, "gmp: (realloc) data clobbered before allocation block\n");
abort ();
}
- if (old_size % BYTES_PER_MP_LIMB == 0)
- if (p[old_size / BYTES_PER_MP_LIMB] != ~((0xdeadbeef << 31) + 0xdeafdeed))
+ if (old_size % GMP_LIMB_BYTES == 0)
+ if (p[old_size / GMP_LIMB_BYTES] != ~((0xdeadbeef << 31) + 0xdeafdeed))
{
fprintf (stderr, "gmp: (realloc) data clobbered after allocation block\n");
abort ();
@@ -85,7 +85,7 @@
oldptr = p - 1;
}
- new_size += 2 * BYTES_PER_MP_LIMB;
+ new_size += 2 * GMP_LIMB_BYTES;
#endif
ret = realloc (oldptr, new_size);
@@ -100,8 +100,8 @@
mp_ptr p = ret;
p++;
p[-1] = (0xdeadbeef << 31) + 0xdeafdeed;
- if (req_size % BYTES_PER_MP_LIMB == 0)
- p[req_size / BYTES_PER_MP_LIMB] = ~((0xdeadbeef << 31) + 0xdeafdeed);
+ if (req_size % GMP_LIMB_BYTES == 0)
+ p[req_size / GMP_LIMB_BYTES] = ~((0xdeadbeef << 31) + 0xdeafdeed);
ret = p;
}
#endif
@@ -121,8 +121,8 @@
fprintf (stderr, "gmp: (free) data clobbered before allocation block\n");
abort ();
}
- if (blk_size % BYTES_PER_MP_LIMB == 0)
- if (p[blk_size / BYTES_PER_MP_LIMB] != ~((0xdeadbeef << 31) + 0xdeafdeed))
+ if (blk_size % GMP_LIMB_BYTES == 0)
+ if (p[blk_size / GMP_LIMB_BYTES] != ~((0xdeadbeef << 31) + 0xdeafdeed))
{
fprintf (stderr, "gmp: (free) data clobbered after allocation block\n");
abort ();
diff -r 97cf62067b72 -r 84d5467c199f mpf/clear.c
--- a/mpf/clear.c Sun Jan 19 13:11:06 2014 +0100
+++ b/mpf/clear.c Sun Jan 19 13:25:03 2014 +0100
@@ -24,5 +24,5 @@
void
mpf_clear (mpf_ptr m)
{
- (*__gmp_free_func) (m->_mp_d, (size_t) (m->_mp_prec + 1) * BYTES_PER_MP_LIMB);
+ (*__gmp_free_func) (m->_mp_d, (size_t) (m->_mp_prec + 1) * GMP_LIMB_BYTES);
}
diff -r 97cf62067b72 -r 84d5467c199f mpf/clears.c
--- a/mpf/clears.c Sun Jan 19 13:11:06 2014 +0100
+++ b/mpf/clears.c Sun Jan 19 13:25:03 2014 +0100
@@ -49,7 +49,7 @@
while (x != NULL)
{
- (*__gmp_free_func) (x->_mp_d, (size_t) (x->_mp_prec + 1) * BYTES_PER_MP_LIMB);
+ (*__gmp_free_func) (x->_mp_d, (size_t) (x->_mp_prec + 1) * GMP_LIMB_BYTES);
x = va_arg (ap, mpf_ptr);
}
va_end (ap);
diff -r 97cf62067b72 -r 84d5467c199f mpf/init.c
--- a/mpf/init.c Sun Jan 19 13:11:06 2014 +0100
+++ b/mpf/init.c Sun Jan 19 13:25:03 2014 +0100
@@ -27,5 +27,5 @@
r->_mp_size = 0;
r->_mp_exp = 0;
r->_mp_prec = prec;
- r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((size_t) (prec + 1) * BYTES_PER_MP_LIMB);
+ r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((size_t) (prec + 1) * GMP_LIMB_BYTES);
}
diff -r 97cf62067b72 -r 84d5467c199f mpf/init2.c
--- a/mpf/init2.c Sun Jan 19 13:11:06 2014 +0100
+++ b/mpf/init2.c Sun Jan 19 13:25:03 2014 +0100
@@ -29,5 +29,5 @@
r->_mp_size = 0;
r->_mp_exp = 0;
r->_mp_prec = prec;
- r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((size_t) (prec + 1) * BYTES_PER_MP_LIMB);
+ r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((size_t) (prec + 1) * GMP_LIMB_BYTES);
}
diff -r 97cf62067b72 -r 84d5467c199f mpf/iset.c
--- a/mpf/iset.c Sun Jan 19 13:11:06 2014 +0100
+++ b/mpf/iset.c Sun Jan 19 13:25:03 2014 +0100
@@ -28,7 +28,7 @@
mp_size_t prec;
prec = __gmp_default_fp_limb_precision;
- r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((size_t) (prec + 1) * BYTES_PER_MP_LIMB);
+ r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((size_t) (prec + 1) * GMP_LIMB_BYTES);
r->_mp_prec = prec;
prec++; /* lie not to lose precision in assignment */
diff -r 97cf62067b72 -r 84d5467c199f mpf/iset_d.c
--- a/mpf/iset_d.c Sun Jan 19 13:11:06 2014 +0100
+++ b/mpf/iset_d.c Sun Jan 19 13:25:03 2014 +0100
@@ -25,7 +25,7 @@
{
mp_size_t prec = __gmp_default_fp_limb_precision;
r->_mp_prec = prec;
- r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((size_t) (prec + 1) * BYTES_PER_MP_LIMB);
+ r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((size_t) (prec + 1) * GMP_LIMB_BYTES);
mpf_set_d (r, val);
}
diff -r 97cf62067b72 -r 84d5467c199f mpf/iset_si.c
--- a/mpf/iset_si.c Sun Jan 19 13:11:06 2014 +0100
+++ b/mpf/iset_si.c Sun Jan 19 13:25:03 2014 +0100
@@ -29,7 +29,7 @@
mp_limb_t vl;
r->_mp_prec = prec;
- r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((size_t) (prec + 1) * BYTES_PER_MP_LIMB);
+ r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((size_t) (prec + 1) * GMP_LIMB_BYTES);
vl = (mp_limb_t) ABS_CAST (unsigned long int, val);
diff -r 97cf62067b72 -r 84d5467c199f mpf/iset_str.c
--- a/mpf/iset_str.c Sun Jan 19 13:11:06 2014 +0100
+++ b/mpf/iset_str.c Sun Jan 19 13:25:03 2014 +0100
@@ -27,7 +27,7 @@
r->_mp_size = 0;
r->_mp_exp = 0;
r->_mp_prec = prec;
- r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((size_t) (prec + 1) * BYTES_PER_MP_LIMB);
+ r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((size_t) (prec + 1) * GMP_LIMB_BYTES);
return mpf_set_str (r, s, base);
}
diff -r 97cf62067b72 -r 84d5467c199f mpf/iset_ui.c
--- a/mpf/iset_ui.c Sun Jan 19 13:11:06 2014 +0100
+++ b/mpf/iset_ui.c Sun Jan 19 13:25:03 2014 +0100
@@ -27,7 +27,7 @@
mp_size_t size;
r->_mp_prec = prec;
- r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((size_t) (prec + 1) * BYTES_PER_MP_LIMB);
+ r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((size_t) (prec + 1) * GMP_LIMB_BYTES);
r->_mp_d[0] = val & GMP_NUMB_MASK;
size = (val != 0);
diff -r 97cf62067b72 -r 84d5467c199f mpn/alpha/ev5/gmp-mparam.h
--- a/mpn/alpha/ev5/gmp-mparam.h Sun Jan 19 13:11:06 2014 +0100
+++ b/mpn/alpha/ev5/gmp-mparam.h Sun Jan 19 13:25:03 2014 +0100
@@ -19,7 +19,7 @@
along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BITS 64
-#define BYTES_PER_MP_LIMB 8
+#define GMP_LIMB_BYTES 8
/* 600 MHz 21164A */
diff -r 97cf62067b72 -r 84d5467c199f mpn/alpha/ev6/gmp-mparam.h
--- a/mpn/alpha/ev6/gmp-mparam.h Sun Jan 19 13:11:06 2014 +0100
+++ b/mpn/alpha/ev6/gmp-mparam.h Sun Jan 19 13:25:03 2014 +0100
@@ -19,7 +19,7 @@
along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BITS 64
-#define BYTES_PER_MP_LIMB 8
+#define GMP_LIMB_BYTES 8
#define DIVEXACT_BY3_METHOD 0 /* override ../diveby3.asm */
diff -r 97cf62067b72 -r 84d5467c199f mpn/alpha/ev6/nails/gmp-mparam.h
--- a/mpn/alpha/ev6/nails/gmp-mparam.h Sun Jan 19 13:11:06 2014 +0100
+++ b/mpn/alpha/ev6/nails/gmp-mparam.h Sun Jan 19 13:25:03 2014 +0100
@@ -18,7 +18,7 @@
along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BITS 64
-#define BYTES_PER_MP_LIMB 8
+#define GMP_LIMB_BYTES 8
/* Generated by tuneup.c, 2004-02-07, gcc 3.3 */
diff -r 97cf62067b72 -r 84d5467c199f mpn/alpha/gmp-mparam.h
--- a/mpn/alpha/gmp-mparam.h Sun Jan 19 13:11:06 2014 +0100
+++ b/mpn/alpha/gmp-mparam.h Sun Jan 19 13:25:03 2014 +0100
@@ -19,7 +19,7 @@
along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BITS 64
-#define BYTES_PER_MP_LIMB 8
+#define GMP_LIMB_BYTES 8
/* 175MHz 21064 */
diff -r 97cf62067b72 -r 84d5467c199f mpn/arm/gmp-mparam.h
--- a/mpn/arm/gmp-mparam.h Sun Jan 19 13:11:06 2014 +0100
+++ b/mpn/arm/gmp-mparam.h Sun Jan 19 13:25:03 2014 +0100
@@ -19,7 +19,7 @@
along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BITS 32
-#define BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
/* 1193MHz ARM (gcc55.fsffrance.org) */
diff -r 97cf62067b72 -r 84d5467c199f mpn/arm/v6/gmp-mparam.h
--- a/mpn/arm/v6/gmp-mparam.h Sun Jan 19 13:11:06 2014 +0100
+++ b/mpn/arm/v6/gmp-mparam.h Sun Jan 19 13:25:03 2014 +0100
@@ -19,7 +19,7 @@
along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BITS 32
-#define BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
/* 700MHz ARM11 (raspberry pi) */
diff -r 97cf62067b72 -r 84d5467c199f mpn/arm/v7a/cora15/gmp-mparam.h
--- a/mpn/arm/v7a/cora15/gmp-mparam.h Sun Jan 19 13:11:06 2014 +0100
+++ b/mpn/arm/v7a/cora15/gmp-mparam.h Sun Jan 19 13:25:03 2014 +0100
@@ -19,7 +19,7 @@
along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BITS 32
-#define BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
/* 1700MHz Cortex-A15 with Neon (in spite of file position) */
diff -r 97cf62067b72 -r 84d5467c199f mpn/arm/v7a/cora9/gmp-mparam.h
--- a/mpn/arm/v7a/cora9/gmp-mparam.h Sun Jan 19 13:11:06 2014 +0100
+++ b/mpn/arm/v7a/cora9/gmp-mparam.h Sun Jan 19 13:25:03 2014 +0100
@@ -19,7 +19,7 @@
along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BITS 32
-#define BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
/* 1000MHz Cortex-A9 */
More information about the gmp-commit
mailing list