[Gmp-commit] /var/hg/gmp: 2 new changesets
mercurial at gmplib.org
mercurial at gmplib.org
Tue Sep 8 16:23:11 UTC 2015
details: /var/hg/gmp/rev/2321c162164e
changeset: 16821:2321c162164e
user: Torbjorn Granlund <torbjorng at google.com>
date: Tue Sep 08 18:22:27 2015 +0200
description:
Wrap remaining limb allocations in __GMP_ALLOCATE_FUNC_LIMBS.
details: /var/hg/gmp/rev/7dc94e85dc54
changeset: 16822:7dc94e85dc54
user: Torbjorn Granlund <torbjorng at google.com>
date: Tue Sep 08 18:23:08 2015 +0200
description:
ChangeLog
diffstat:
ChangeLog | 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 +-
mpq/init.c | 4 ++--
mpz/array_init.c | 2 +-
mpz/init.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 | 2 +-
17 files changed, 20 insertions(+), 18 deletions(-)
diffs (212 lines):
diff -r 30c1295f7037 -r 7dc94e85dc54 ChangeLog
--- a/ChangeLog Sun Sep 06 19:38:14 2015 +0200
+++ b/ChangeLog Tue Sep 08 18:23:08 2015 +0200
@@ -1,5 +1,7 @@
2015-09-06 Torbjörn Granlund <torbjorng at google.com>
+ * Wrap remaining limb allocations in __GMP_ALLOCATE_FUNC_LIMBS.
+
* mpn/x86/fat/fat.c (fake_cpuid_table): Add missing commas.
* mpn/x86_64/fat/fat.c: Likewise.
diff -r 30c1295f7037 -r 7dc94e85dc54 mpf/init.c
--- a/mpf/init.c Sun Sep 06 19:38:14 2015 +0200
+++ b/mpf/init.c Tue Sep 08 18:23:08 2015 +0200
@@ -38,5 +38,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) * GMP_LIMB_BYTES);
+ r->_mp_d = __GMP_ALLOCATE_FUNC_LIMBS (prec + 1);
}
diff -r 30c1295f7037 -r 7dc94e85dc54 mpf/init2.c
--- a/mpf/init2.c Sun Sep 06 19:38:14 2015 +0200
+++ b/mpf/init2.c Tue Sep 08 18:23:08 2015 +0200
@@ -40,5 +40,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) * GMP_LIMB_BYTES);
+ r->_mp_d = __GMP_ALLOCATE_FUNC_LIMBS (prec + 1);
}
diff -r 30c1295f7037 -r 7dc94e85dc54 mpf/iset.c
--- a/mpf/iset.c Sun Sep 06 19:38:14 2015 +0200
+++ b/mpf/iset.c Tue Sep 08 18:23:08 2015 +0200
@@ -39,7 +39,7 @@
mp_size_t prec;
prec = __gmp_default_fp_limb_precision;
- r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((size_t) (prec + 1) * GMP_LIMB_BYTES);
+ r->_mp_d = __GMP_ALLOCATE_FUNC_LIMBS (prec + 1);
r->_mp_prec = prec;
prec++; /* lie not to lose precision in assignment */
diff -r 30c1295f7037 -r 7dc94e85dc54 mpf/iset_d.c
--- a/mpf/iset_d.c Sun Sep 06 19:38:14 2015 +0200
+++ b/mpf/iset_d.c Tue Sep 08 18:23:08 2015 +0200
@@ -36,7 +36,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) * GMP_LIMB_BYTES);
+ r->_mp_d = __GMP_ALLOCATE_FUNC_LIMBS (prec + 1);
mpf_set_d (r, val);
}
diff -r 30c1295f7037 -r 7dc94e85dc54 mpf/iset_si.c
--- a/mpf/iset_si.c Sun Sep 06 19:38:14 2015 +0200
+++ b/mpf/iset_si.c Tue Sep 08 18:23:08 2015 +0200
@@ -40,7 +40,7 @@
mp_limb_t vl;
r->_mp_prec = prec;
- r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((size_t) (prec + 1) * GMP_LIMB_BYTES);
+ r->_mp_d = __GMP_ALLOCATE_FUNC_LIMBS (prec + 1);
vl = (mp_limb_t) ABS_CAST (unsigned long int, val);
diff -r 30c1295f7037 -r 7dc94e85dc54 mpf/iset_str.c
--- a/mpf/iset_str.c Sun Sep 06 19:38:14 2015 +0200
+++ b/mpf/iset_str.c Tue Sep 08 18:23:08 2015 +0200
@@ -38,7 +38,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) * GMP_LIMB_BYTES);
+ r->_mp_d = __GMP_ALLOCATE_FUNC_LIMBS (prec + 1);
return mpf_set_str (r, s, base);
}
diff -r 30c1295f7037 -r 7dc94e85dc54 mpf/iset_ui.c
--- a/mpf/iset_ui.c Sun Sep 06 19:38:14 2015 +0200
+++ b/mpf/iset_ui.c Tue Sep 08 18:23:08 2015 +0200
@@ -38,7 +38,7 @@
mp_size_t size;
r->_mp_prec = prec;
- r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((size_t) (prec + 1) * GMP_LIMB_BYTES);
+ r->_mp_d = __GMP_ALLOCATE_FUNC_LIMBS (prec + 1);
r->_mp_d[0] = val & GMP_NUMB_MASK;
size = (val != 0);
diff -r 30c1295f7037 -r 7dc94e85dc54 mpq/init.c
--- a/mpq/init.c Sun Sep 06 19:38:14 2015 +0200
+++ b/mpq/init.c Tue Sep 08 18:23:08 2015 +0200
@@ -35,10 +35,10 @@
mpq_init (mpq_t x)
{
ALLOC(NUM(x)) = 1;
- PTR(NUM(x)) = (mp_ptr) (*__gmp_allocate_func) (GMP_LIMB_BYTES);
+ PTR(NUM(x)) = __GMP_ALLOCATE_FUNC_LIMBS (1);
SIZ(NUM(x)) = 0;
ALLOC(DEN(x)) = 1;
- PTR(DEN(x)) = (mp_ptr) (*__gmp_allocate_func) (GMP_LIMB_BYTES);
+ PTR(DEN(x)) = __GMP_ALLOCATE_FUNC_LIMBS (1);
PTR(DEN(x))[0] = 1;
SIZ(DEN(x)) = 1;
diff -r 30c1295f7037 -r 7dc94e85dc54 mpz/array_init.c
--- a/mpz/array_init.c Sun Sep 06 19:38:14 2015 +0200
+++ b/mpz/array_init.c Tue Sep 08 18:23:08 2015 +0200
@@ -39,7 +39,7 @@
mp_size_t nlimbs;
nlimbs = nbits / GMP_NUMB_BITS + 1;
- p = (mp_ptr) (*__gmp_allocate_func) ((size_t) arr_size * nlimbs * GMP_LIMB_BYTES);
+ p = __GMP_ALLOCATE_FUNC_LIMBS (arr_size * nlimbs);
for (i = 0; i < arr_size; i++)
{
diff -r 30c1295f7037 -r 7dc94e85dc54 mpz/init.c
--- a/mpz/init.c Sun Sep 06 19:38:14 2015 +0200
+++ b/mpz/init.c Tue Sep 08 18:23:08 2015 +0200
@@ -35,7 +35,7 @@
mpz_init (mpz_ptr x)
{
ALLOC (x) = 1;
- PTR (x) = (mp_ptr) (*__gmp_allocate_func) (GMP_LIMB_BYTES);
+ PTR (x) = __GMP_ALLOCATE_FUNC_LIMBS (1);
SIZ (x) = 0;
#ifdef __CHECKER__
diff -r 30c1295f7037 -r 7dc94e85dc54 mpz/iset.c
--- a/mpz/iset.c Sun Sep 06 19:38:14 2015 +0200
+++ b/mpz/iset.c Tue Sep 08 18:23:08 2015 +0200
@@ -43,7 +43,7 @@
size = ABS (usize);
ALLOC (w) = MAX (size, 1);
- PTR (w) = (mp_ptr) (*__gmp_allocate_func) ((size_t) ALLOC (w) * GMP_LIMB_BYTES);
+ PTR (w) = __GMP_ALLOCATE_FUNC_LIMBS (ALLOC (w));
wp = PTR (w);
up = PTR (u);
diff -r 30c1295f7037 -r 7dc94e85dc54 mpz/iset_d.c
--- a/mpz/iset_d.c Sun Sep 06 19:38:14 2015 +0200
+++ b/mpz/iset_d.c Tue Sep 08 18:23:08 2015 +0200
@@ -36,7 +36,7 @@
mpz_init_set_d (mpz_ptr dest, double val)
{
ALLOC (dest) = 1;
- PTR (dest) = (mp_ptr) (*__gmp_allocate_func) (GMP_LIMB_BYTES);
+ PTR (dest) = __GMP_ALLOCATE_FUNC_LIMBS (1);
SIZ (dest) = 0;
mpz_set_d (dest, val);
}
diff -r 30c1295f7037 -r 7dc94e85dc54 mpz/iset_si.c
--- a/mpz/iset_si.c Sun Sep 06 19:38:14 2015 +0200
+++ b/mpz/iset_si.c Tue Sep 08 18:23:08 2015 +0200
@@ -39,7 +39,7 @@
mp_limb_t vl;
ALLOC (dest) = 1;
- PTR (dest) = (mp_ptr) (*__gmp_allocate_func) (GMP_LIMB_BYTES);
+ PTR (dest) = __GMP_ALLOCATE_FUNC_LIMBS (1);
vl = (mp_limb_t) ABS_CAST (unsigned long int, val);
diff -r 30c1295f7037 -r 7dc94e85dc54 mpz/iset_str.c
--- a/mpz/iset_str.c Sun Sep 06 19:38:14 2015 +0200
+++ b/mpz/iset_str.c Tue Sep 08 18:23:08 2015 +0200
@@ -38,7 +38,7 @@
mpz_init_set_str (mpz_ptr x, const char *str, int base)
{
ALLOC (x) = 1;
- PTR (x) = (mp_ptr) (*__gmp_allocate_func) (GMP_LIMB_BYTES);
+ PTR (x) = __GMP_ALLOCATE_FUNC_LIMBS (1);
/* if str has no digits mpz_set_str leaves x->_mp_size unset */
SIZ (x) = 0;
diff -r 30c1295f7037 -r 7dc94e85dc54 mpz/iset_ui.c
--- a/mpz/iset_ui.c Sun Sep 06 19:38:14 2015 +0200
+++ b/mpz/iset_ui.c Tue Sep 08 18:23:08 2015 +0200
@@ -41,7 +41,7 @@
if (val > GMP_NUMB_MAX)
{
ALLOC (dest) = 2;
- PTR (dest) = (mp_ptr) (*__gmp_allocate_func) (GMP_LIMB_BYTES*2);
+ PTR (dest) = __GMP_ALLOCATE_FUNC_LIMBS (2);
PTR (dest)[1] = val >> GMP_NUMB_BITS;
size = 2;
}
@@ -49,7 +49,7 @@
#endif
{
ALLOC (dest) = 1;
- PTR (dest) = (mp_ptr) (*__gmp_allocate_func) (GMP_LIMB_BYTES);
+ PTR (dest) = __GMP_ALLOCATE_FUNC_LIMBS (1);
size = val != 0;
}
diff -r 30c1295f7037 -r 7dc94e85dc54 mpz/mul.c
--- a/mpz/mul.c Sun Sep 06 19:38:14 2015 +0200
+++ b/mpz/mul.c Tue Sep 08 18:23:08 2015 +0200
@@ -113,7 +113,7 @@
(*__gmp_free_func) (wp, (size_t) ALLOC (w) * GMP_LIMB_BYTES);
ALLOC (w) = wsize;
- wp = (mp_ptr) (*__gmp_allocate_func) ((size_t) wsize * GMP_LIMB_BYTES);
+ wp = __GMP_ALLOCATE_FUNC_LIMBS (wsize);
PTR (w) = wp;
}
else
More information about the gmp-commit
mailing list