[Gmp-commit] /var/hg/gmp: 2 new changesets
mercurial at gmplib.org
mercurial at gmplib.org
Sun Jan 13 21:23:35 CET 2013
details: /var/hg/gmp/rev/7993bbf79eec
changeset: 15267:7993bbf79eec
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Sun Jan 13 21:20:29 2013 +0100
description:
mini-gmp/mini-gmp.c (mpz_hamdist): Handle different sizes.
details: /var/hg/gmp/rev/25491d3545bf
changeset: 15268:25491d3545bf
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Sun Jan 13 21:21:46 2013 +0100
description:
mini-gmp/tests/t-logops.c: Test also popcount and hamdist.
diffstat:
ChangeLog | 11 +++++++----
mini-gmp/mini-gmp.c | 2 +-
mini-gmp/tests/t-logops.c | 11 +++++++++++
3 files changed, 19 insertions(+), 5 deletions(-)
diffs (63 lines):
diff -r e1a986a1e808 -r 25491d3545bf ChangeLog
--- a/ChangeLog Sun Jan 13 19:18:55 2013 +0100
+++ b/ChangeLog Sun Jan 13 21:21:46 2013 +0100
@@ -9,19 +9,22 @@
* mini-gmp/mini-gmp.c (NEG_CAST): New macro.
(mpz_mul_si, mpz_set_si, mpz_cmp_si): Use NEG_CAST.
-
+
* mini-gmp/mini-gmp.c (mpz_set_si, mpz_cmp_si): Simplify by using
the _ui variant.
* mini-gmp/tests/t-root.c: Use mpz_ui_pow_ui, when base fits an ui.
-
+
* mini-gmp/tests/t-mul.c: Test also mpz_mul_si.
* mini-gmp/tests/t-sub.c: Test also mpz_ui_sub.
-
+
* mini-gmp/mini-gmp.c (mpz_fits_slong_p): Correct range.
* mini-gmp/tests/t-signed.c: New test program, for get/set/cmp_si.
* mini-gmp/tests/Makefile (CHECK_PROGRAMS): Added t-signed.
-
+
+ * mini-gmp/mini-gmp.c (mpz_hamdist): Handle different sizes.
+ * mini-gmp/tests/t-logops.c: Test also popcount and hamdist.
+
2013-01-10 Marco Bodrato <bodrato at mail.dm.unipi.it>
* mpz/export.c: Less restrictive ASSERTs.
diff -r e1a986a1e808 -r 25491d3545bf mini-gmp/mini-gmp.c
--- a/mini-gmp/mini-gmp.c Sun Jan 13 19:18:55 2013 +0100
+++ b/mini-gmp/mini-gmp.c Sun Jan 13 21:21:46 2013 +0100
@@ -3620,7 +3620,7 @@
}
assert (vc == 0);
- for (; i < vn; i++)
+ for (; i < un; i++)
{
ul = (up[i] ^ comp) + uc;
uc = ul < uc;
diff -r e1a986a1e808 -r 25491d3545bf mini-gmp/tests/t-logops.c
--- a/mini-gmp/tests/t-logops.c Sun Jan 13 19:18:55 2013 +0100
+++ b/mini-gmp/tests/t-logops.c Sun Jan 13 21:21:46 2013 +0100
@@ -84,6 +84,17 @@
dump ("ref", ref);
abort ();
}
+
+ if (mpz_popcount (a) != mpz_hamdist (res, b))
+ {
+ fprintf (stderr, "mpz_popcount(a) and mpz_hamdist(r,b) differ:\n");
+ dump ("a", a);
+ dump ("b", b);
+ dump ("r", res);
+ fprintf (stderr, "mpz_popcount(a) = %lu:\n", mpz_popcount (a));
+ fprintf (stderr, "mpz_hamdist(r,b) = %lu:\n", mpz_hamdist (res, b));
+ abort ();
+ }
}
mpz_clear (a);
mpz_clear (b);
More information about the gmp-commit
mailing list