[Gmp-commit] /var/hg/gmp: 9 new changesets
mercurial at gmplib.org
mercurial at gmplib.org
Sun Jan 19 12:11:10 UTC 2014
details: /var/hg/gmp/rev/47c92147cd12
changeset: 16212:47c92147cd12
user: Torbjorn Granlund <tege at gmplib.org>
date: Sun Jan 19 12:48:32 2014 +0100
description:
Retune.
details: /var/hg/gmp/rev/8aa56aec7b46
changeset: 16213:8aa56aec7b46
user: Torbjorn Granlund <tege at gmplib.org>
date: Sun Jan 19 12:56:08 2014 +0100
description:
Fix typo in last change.
details: /var/hg/gmp/rev/e8ee5a7be72e
changeset: 16214:e8ee5a7be72e
user: Torbjorn Granlund <tege at gmplib.org>
date: Sun Jan 19 12:57:21 2014 +0100
description:
Call __gmp_free_func ourselves instead of via mpf_clears.
details: /var/hg/gmp/rev/81237a94e553
changeset: 16215:81237a94e553
user: Torbjorn Granlund <tege at gmplib.org>
date: Sun Jan 19 13:00:33 2014 +0100
description:
Add a copyright year.
details: /var/hg/gmp/rev/4d54f42f2717
changeset: 16216:4d54f42f2717
user: Torbjorn Granlund <tege at gmplib.org>
date: Sun Jan 19 13:01:40 2014 +0100
description:
Call __gmp_free_func ourselves instead of via mpq_clears.
details: /var/hg/gmp/rev/dcd6999a75fe
changeset: 16217:dcd6999a75fe
user: Torbjorn Granlund <tege at gmplib.org>
date: Sun Jan 19 13:04:21 2014 +0100
description:
Avoid two overflow scenarios in allocation computation.
details: /var/hg/gmp/rev/fed198c137c0
changeset: 16218:fed198c137c0
user: Torbjorn Granlund <tege at gmplib.org>
date: Sun Jan 19 13:09:18 2014 +0100
description:
Add cast to avoid overflow of (later ignored) argument.
details: /var/hg/gmp/rev/32bc68320fb4
changeset: 16219:32bc68320fb4
user: Torbjorn Granlund <tege at gmplib.org>
date: Sun Jan 19 13:10:19 2014 +0100
description:
Avoid overflow in allocation computation.
details: /var/hg/gmp/rev/97cf62067b72
changeset: 16220:97cf62067b72
user: Torbjorn Granlund <tege at gmplib.org>
date: Sun Jan 19 13:11:06 2014 +0100
description:
ChangeLog
diffstat:
ChangeLog | 16 ++++
mpf/clear.c | 2 +-
mpf/clears.c | 4 +-
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/s390_64/gmp-mparam.h | 160 +++++++++++++++++++++++-----------------------
mpq/clear.c | 4 +-
mpq/clears.c | 7 +-
mpz/array_init.c | 8 +-
mpz/clears.c | 2 +-
mpz/iset.c | 2 +-
mpz/mul.c | 4 +-
17 files changed, 120 insertions(+), 103 deletions(-)
diffs (truncated from 460 to 300 lines):
diff -r 1927c5844137 -r 97cf62067b72 ChangeLog
--- a/ChangeLog Sun Jan 19 12:23:20 2014 +0100
+++ b/ChangeLog Sun Jan 19 13:11:06 2014 +0100
@@ -1,11 +1,27 @@
2014-01-19 Torbjorn Granlund <tege at gmplib.org>
+ * mpz/iset.c: Avoid overflow in allocation computation.
+ * mpz/mul.c: Likewise.
+ * mpf/init.c: Likewise.
+ * mpf/init2.c: Likewise.
+ * mpf/iset.c: Likewise.
+ * mpf/iset_d.c: Likewise.
+ * mpf/iset_si.c: Likewise.
+ * mpf/iset_str.c: Likewise.
+ * mpf/iset_ui.c: Likewise.
+
+ * mpz/array_init.c: Avoid two overflow scenarios in allocation
+ computation.
+
* mpn/s390_64/z10/gmp-mparam.h: New file.
* mpz/clears.c: Call __gmp_free_func ourselves instead of via
mpz_clears.
+ * mpf/clears.c: Analogous change.
+ * mpq/clears.c: Analogous change.
* mpz/clear.c: Add cast to avoid overflow of (later ignored) argument.
+ * mpf/clear.c: Likewise.
2014-01-19 Marco Bodrato <bodrato at mail.dm.unipi.it>
diff -r 1927c5844137 -r 97cf62067b72 mpf/clear.c
--- a/mpf/clear.c Sun Jan 19 12:23:20 2014 +0100
+++ b/mpf/clear.c Sun Jan 19 13:11:06 2014 +0100
@@ -24,5 +24,5 @@
void
mpf_clear (mpf_ptr m)
{
- (*__gmp_free_func) (m->_mp_d, (m->_mp_prec + 1) * BYTES_PER_MP_LIMB);
+ (*__gmp_free_func) (m->_mp_d, (size_t) (m->_mp_prec + 1) * BYTES_PER_MP_LIMB);
}
diff -r 1927c5844137 -r 97cf62067b72 mpf/clears.c
--- a/mpf/clears.c Sun Jan 19 12:23:20 2014 +0100
+++ b/mpf/clears.c Sun Jan 19 13:11:06 2014 +0100
@@ -1,6 +1,6 @@
/* mpf_clears() -- Clear multiple mpf_t variables.
-Copyright 2009 Free Software Foundation, Inc.
+Copyright 2009, 2014 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -49,7 +49,7 @@
while (x != NULL)
{
- mpf_clear (x);
+ (*__gmp_free_func) (x->_mp_d, (size_t) (x->_mp_prec + 1) * BYTES_PER_MP_LIMB);
x = va_arg (ap, mpf_ptr);
}
va_end (ap);
diff -r 1927c5844137 -r 97cf62067b72 mpf/init.c
--- a/mpf/init.c Sun Jan 19 12:23:20 2014 +0100
+++ b/mpf/init.c Sun Jan 19 13:11:06 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) ((prec + 1) * BYTES_PER_MP_LIMB);
+ r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((size_t) (prec + 1) * BYTES_PER_MP_LIMB);
}
diff -r 1927c5844137 -r 97cf62067b72 mpf/init2.c
--- a/mpf/init2.c Sun Jan 19 12:23:20 2014 +0100
+++ b/mpf/init2.c Sun Jan 19 13:11:06 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) ((prec + 1) * BYTES_PER_MP_LIMB);
+ r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((size_t) (prec + 1) * BYTES_PER_MP_LIMB);
}
diff -r 1927c5844137 -r 97cf62067b72 mpf/iset.c
--- a/mpf/iset.c Sun Jan 19 12:23:20 2014 +0100
+++ b/mpf/iset.c Sun Jan 19 13:11:06 2014 +0100
@@ -28,7 +28,7 @@
mp_size_t prec;
prec = __gmp_default_fp_limb_precision;
- r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((prec + 1) * BYTES_PER_MP_LIMB);
+ r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((size_t) (prec + 1) * BYTES_PER_MP_LIMB);
r->_mp_prec = prec;
prec++; /* lie not to lose precision in assignment */
diff -r 1927c5844137 -r 97cf62067b72 mpf/iset_d.c
--- a/mpf/iset_d.c Sun Jan 19 12:23:20 2014 +0100
+++ b/mpf/iset_d.c Sun Jan 19 13:11:06 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) ((prec + 1) * BYTES_PER_MP_LIMB);
+ r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((size_t) (prec + 1) * BYTES_PER_MP_LIMB);
mpf_set_d (r, val);
}
diff -r 1927c5844137 -r 97cf62067b72 mpf/iset_si.c
--- a/mpf/iset_si.c Sun Jan 19 12:23:20 2014 +0100
+++ b/mpf/iset_si.c Sun Jan 19 13:11:06 2014 +0100
@@ -29,7 +29,7 @@
mp_limb_t vl;
r->_mp_prec = prec;
- r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((prec + 1) * BYTES_PER_MP_LIMB);
+ r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((size_t) (prec + 1) * BYTES_PER_MP_LIMB);
vl = (mp_limb_t) ABS_CAST (unsigned long int, val);
diff -r 1927c5844137 -r 97cf62067b72 mpf/iset_str.c
--- a/mpf/iset_str.c Sun Jan 19 12:23:20 2014 +0100
+++ b/mpf/iset_str.c Sun Jan 19 13:11:06 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) ((prec + 1) * BYTES_PER_MP_LIMB);
+ r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((size_t) (prec + 1) * BYTES_PER_MP_LIMB);
return mpf_set_str (r, s, base);
}
diff -r 1927c5844137 -r 97cf62067b72 mpf/iset_ui.c
--- a/mpf/iset_ui.c Sun Jan 19 12:23:20 2014 +0100
+++ b/mpf/iset_ui.c Sun Jan 19 13:11:06 2014 +0100
@@ -27,7 +27,7 @@
mp_size_t size;
r->_mp_prec = prec;
- r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((prec + 1) * BYTES_PER_MP_LIMB);
+ r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((size_t) (prec + 1) * BYTES_PER_MP_LIMB);
r->_mp_d[0] = val & GMP_NUMB_MASK;
size = (val != 0);
diff -r 1927c5844137 -r 97cf62067b72 mpn/s390_64/gmp-mparam.h
--- a/mpn/s390_64/gmp-mparam.h Sun Jan 19 12:23:20 2014 +0100
+++ b/mpn/s390_64/gmp-mparam.h Sun Jan 19 13:11:06 2014 +0100
@@ -27,140 +27,138 @@
#define MOD_1_1P_METHOD 2
#define MOD_1_NORM_THRESHOLD 0 /* always */
#define MOD_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 8
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 5
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 38
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 19
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 9
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 6
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 62
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 17
#define USE_PREINV_DIVREM_1 1
+#define DIV_QR_1N_PI1_METHOD 1
+#define DIV_QR_1_NORM_THRESHOLD 0 /* always */
+#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIVEXACT_1_THRESHOLD 0 /* always */
-#define BMOD_1_TO_MOD_1_THRESHOLD 88
+#define BMOD_1_TO_MOD_1_THRESHOLD 98
#define MUL_TOOM22_THRESHOLD 10
#define MUL_TOOM33_THRESHOLD 41
-#define MUL_TOOM44_THRESHOLD 104
+#define MUL_TOOM44_THRESHOLD 105
#define MUL_TOOM6H_THRESHOLD 149
#define MUL_TOOM8H_THRESHOLD 212
#define MUL_TOOM32_TO_TOOM43_THRESHOLD 65
#define MUL_TOOM32_TO_TOOM53_THRESHOLD 69
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 73
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 66
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 72
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 64
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 55
-#define SQR_BASECASE_THRESHOLD 0
+#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
#define SQR_TOOM2_THRESHOLD 16
#define SQR_TOOM3_THRESHOLD 57
-#define SQR_TOOM4_THRESHOLD 154
-#define SQR_TOOM6_THRESHOLD 206
+#define SQR_TOOM4_THRESHOLD 153
+#define SQR_TOOM6_THRESHOLD 204
#define SQR_TOOM8_THRESHOLD 309
#define MULMID_TOOM42_THRESHOLD 20
-#define MULMOD_BNM1_THRESHOLD 9
+#define MULMOD_BNM1_THRESHOLD 10
#define SQRMOD_BNM1_THRESHOLD 11
-#define POWM_SEC_TABLE 4,23,128,598
-
#define MUL_FFT_MODF_THRESHOLD 220 /* k = 5 */
#define MUL_FFT_TABLE3 \
- { { 220, 5}, { 7, 4}, { 15, 5}, { 8, 4}, \
- { 17, 5}, { 11, 6}, { 6, 5}, { 13, 6}, \
+ { { 220, 5}, { 11, 6}, { 6, 5}, { 13, 6}, \
{ 7, 5}, { 15, 6}, { 13, 7}, { 7, 6}, \
{ 15, 7}, { 8, 6}, { 17, 7}, { 9, 6}, \
{ 19, 7}, { 13, 8}, { 7, 7}, { 17, 8}, \
- { 9, 7}, { 19, 8}, { 11, 7}, { 23, 8}, \
- { 13, 9}, { 7, 8}, { 19, 9}, { 11, 8}, \
- { 25,10}, { 7, 9}, { 15, 8}, { 33, 9}, \
- { 19, 8}, { 39, 9}, { 23,10}, { 15, 9}, \
- { 39,10}, { 23,11}, { 15,10}, { 31, 9}, \
- { 63,10}, { 39, 9}, { 79,10}, { 47,11}, \
- { 31,10}, { 63, 9}, { 127, 8}, { 255,10}, \
- { 71, 9}, { 143, 8}, { 287,10}, { 79,11}, \
- { 47,12}, { 31,11}, { 63,10}, { 127, 9}, \
- { 255, 8}, { 511,10}, { 143,11}, { 79,10}, \
- { 159, 9}, { 319,10}, { 175, 9}, { 351, 8}, \
- { 703,11}, { 95,10}, { 191, 9}, { 383,10}, \
+ { 9, 7}, { 19, 8}, { 13, 9}, { 7, 8}, \
+ { 19, 9}, { 11, 8}, { 23,10}, { 7, 9}, \
+ { 15, 8}, { 33, 9}, { 19, 8}, { 39, 9}, \
+ { 23,10}, { 15, 9}, { 39,10}, { 23,11}, \
+ { 15,10}, { 31, 9}, { 63,10}, { 39, 9}, \
+ { 79,10}, { 47,11}, { 31,10}, { 63, 9}, \
+ { 127, 8}, { 255,10}, { 71, 9}, { 143, 8}, \
+ { 287,10}, { 79,11}, { 47,12}, { 31,11}, \
+ { 63,10}, { 127, 9}, { 255, 8}, { 511,10}, \
+ { 143, 9}, { 287,11}, { 79,10}, { 159, 9}, \
+ { 319,10}, { 175, 9}, { 351, 8}, { 703, 7}, \
+ { 1407,11}, { 95,10}, { 191, 9}, { 383,10}, \
{ 207,11}, { 111,10}, { 223,12}, { 63,11}, \
{ 127,10}, { 255, 9}, { 511,11}, { 143,10}, \
{ 287, 9}, { 575, 8}, { 1151,10}, { 319,11}, \
{ 175,10}, { 351, 9}, { 703,12}, { 95,11}, \
{ 191,10}, { 383, 9}, { 767,11}, { 207,10}, \
- { 415, 9}, { 831,11}, { 223,13}, { 63,12}, \
- { 127,11}, { 255,10}, { 511,11}, { 287,10}, \
- { 575, 9}, { 1151,12}, { 159,11}, { 319,10}, \
- { 639,11}, { 351,10}, { 703, 9}, { 1407, 8}, \
- { 2815,11}, { 383,10}, { 767,11}, { 415,10}, \
- { 831,12}, { 223,11}, { 447, 9}, { 1791,11}, \
- { 479,13}, { 8192,14}, { 16384,15}, { 32768,16}, \
- { 65536,17}, { 131072,18}, { 262144,19}, { 524288,20}, \
- {1048576,21}, {2097152,22}, {4194304,23}, {8388608,24} }
-#define MUL_FFT_TABLE3_SIZE 124
-#define MUL_FFT_THRESHOLD 2240
+ { 415,11}, { 223,13}, { 8192,14}, { 16384,15}, \
+ { 32768,16}, { 65536,17}, { 131072,18}, { 262144,19}, \
+ { 524288,20}, {1048576,21}, {2097152,22}, {4194304,23}, \
+ {8388608,24} }
+#define MUL_FFT_TABLE3_SIZE 97
+#define MUL_FFT_THRESHOLD 1728
-#define SQR_FFT_MODF_THRESHOLD 184 /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD 212 /* k = 5 */
#define SQR_FFT_TABLE3 \
- { { 184, 5}, { 6, 4}, { 13, 5}, { 13, 6}, \
+ { { 212, 5}, { 7, 4}, { 15, 5}, { 13, 6}, \
{ 7, 5}, { 15, 6}, { 15, 7}, { 8, 6}, \
- { 17, 7}, { 16, 8}, { 9, 7}, { 19, 8}, \
- { 11, 7}, { 23, 8}, { 13, 9}, { 7, 8}, \
- { 19, 9}, { 11, 8}, { 25,10}, { 7, 9}, \
- { 15, 8}, { 31, 9}, { 23,10}, { 15, 9}, \
+ { 17, 7}, { 13, 8}, { 7, 7}, { 17, 8}, \
+ { 9, 7}, { 19, 8}, { 11, 7}, { 23, 8}, \
+ { 13, 9}, { 7, 8}, { 19, 9}, { 11, 8}, \
+ { 25,10}, { 7, 9}, { 15, 8}, { 31, 9}, \
+ { 19, 8}, { 39, 9}, { 23,10}, { 15, 9}, \
{ 39,10}, { 23,11}, { 15,10}, { 31, 9}, \
{ 63,10}, { 47,11}, { 31,10}, { 63, 9}, \
{ 127, 8}, { 255,10}, { 71, 9}, { 143, 8}, \
- { 287, 7}, { 575,10}, { 79,11}, { 47,12}, \
- { 31,11}, { 63,10}, { 127, 9}, { 255,10}, \
+ { 287,10}, { 79,11}, { 47,12}, { 31,11}, \
+ { 63,10}, { 127, 9}, { 255, 8}, { 511,10}, \
{ 143, 9}, { 287,11}, { 79,10}, { 159, 9}, \
- { 319, 8}, { 639,10}, { 175, 9}, { 351,11}, \
- { 95,10}, { 191, 9}, { 383, 8}, { 767,11}, \
- { 111,10}, { 223,12}, { 63,11}, { 127,10}, \
- { 255, 9}, { 511,11}, { 143,10}, { 287, 9}, \
- { 575,11}, { 159,10}, { 319, 9}, { 639,11}, \
- { 175,10}, { 351,12}, { 95,11}, { 191,10}, \
- { 383, 9}, { 767,11}, { 207,10}, { 415, 9}, \
- { 831,11}, { 223,13}, { 63,12}, { 127,11}, \
- { 255,10}, { 511,11}, { 287,10}, { 575,12}, \
- { 159,11}, { 319,10}, { 639,11}, { 351,10}, \
- { 703,12}, { 191,11}, { 383,10}, { 767,11}, \
- { 415,12}, { 223,11}, { 447,13}, { 8192,14}, \
- { 16384,15}, { 32768,16}, { 65536,17}, { 131072,18}, \
- { 262144,19}, { 524288,20}, {1048576,21}, {2097152,22}, \
- {4194304,23}, {8388608,24} }
-#define SQR_FFT_TABLE3_SIZE 106
+ { 319, 8}, { 639,10}, { 175, 9}, { 351, 8}, \
+ { 703,10}, { 191, 9}, { 383, 8}, { 767,10}, \
+ { 207, 9}, { 415,11}, { 111,10}, { 223,12}, \
+ { 63,11}, { 127,10}, { 255, 9}, { 511,11}, \
+ { 143,10}, { 287, 9}, { 575, 8}, { 1151,11}, \
+ { 159,10}, { 319,11}, { 175,10}, { 351, 9}, \
More information about the gmp-commit
mailing list