[Gmp-commit] /var/hg/gmp: Test longer bit strings.

mercurial at gmplib.org mercurial at gmplib.org
Thu Jan 12 13:41:46 CET 2012


details:   /var/hg/gmp/rev/9b32f0184124
changeset: 14567:9b32f0184124
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Thu Jan 12 13:41:41 2012 +0100
description:
Test longer bit strings.

diffstat:

 ChangeLog      |   4 ++++
 tests/t-popc.c |  16 +++++++++++++++-
 2 files changed, 19 insertions(+), 1 deletions(-)

diffs (43 lines):

diff -r 6a17b1b9901a -r 9b32f0184124 ChangeLog
--- a/ChangeLog	Thu Jan 12 12:09:36 2012 +0100
+++ b/ChangeLog	Thu Jan 12 13:41:41 2012 +0100
@@ -1,3 +1,7 @@
+2012-01-12  Torbjorn Granlund  <tege at gmplib.org>
+
+	* tests/t-popc.c: Test longer bit strings.
+
 2012-01-12 Marco Bodrato <bodrato at mail.dm.unipi.it>
 
 	* mpz/divexact.c: Tight realloc, delayed if variables are reused.
diff -r 6a17b1b9901a -r 9b32f0184124 tests/t-popc.c
--- a/tests/t-popc.c	Thu Jan 12 12:09:36 2012 +0100
+++ b/tests/t-popc.c	Thu Jan 12 13:41:41 2012 +0100
@@ -1,6 +1,6 @@
 /* Test popc_limb.
 
-Copyright 2002 Free Software Foundation, Inc.
+Copyright 2002, 2012 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -51,6 +51,20 @@
         }
     }
 
+  src = 0;
+  want = 0;
+  for (i = 0; i < GMP_LIMB_BITS; i++)
+    {
+      src += CNST_LIMB(1) << i;
+      want += 1;
+
+      popc_limb (got, src);
+      if (got != want)
+        {
+	  goto error;
+        }
+    }
+
   for (i = 0; i < 100; i++)
     {
       mpn_random2 (&src, (mp_size_t) 1);


More information about the gmp-commit mailing list