bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#12350: Composites identified as primes in factor.c (when HAVE_GMP)


From: Jim Meyering
Subject: bug#12350: Composites identified as primes in factor.c (when HAVE_GMP)
Date: Thu, 13 Sep 2012 12:20:30 +0200

Torbjorn Granlund wrote:
> We won't be sending any more code replacement blobs to this address; it
> is most surely the wrong place.

Hi Torbjorn,

I guess you're saying that because there's been too little feedback?
IMHO, this is great work.
I've been reviewing the latest and had prepared several patches.
Just hadn't made time to send them.

> Please get our suggested factor.c replacement from
> <http://gmplib.org:8000/factoring/>.
>
> I plan to spend no more time on this project now.  Should the
> contribution be accepted, I will make the necessary amendments to the

You may consider it accepted.  That was clear in my mind from
the beginning.  Sorry if I didn't make that clear to you.
Now, it's just a matter of integrating it.

> GNU copyright paperwork.  I am certainly willing to answer questions
> about the code, of course.

Here are some suggested changes -- I made these against
a temporary local git repository using your -005 tarball.
That was before I learned (just now) that you have a mercurial
repository.

I made the Makefile parallelization changes mostly to avoid
waiting too long when I run "make check" -- in the very short run.
Obviously we cannot use its GNU make features in coreutils/tests.

In coreutils, we are pretty strict on warnings, so most of these
changes are to avoid the few that remained.  I've also moved
some declarations "down" to be nearer their point of first
initialization.  That's another style issue in coreutils.  We
are no longer required to declare all variables at the top of
each block.

>From bc5f37195abb5c0f9de7d65f5cc937ab902cd774 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 11 Sep 2012 11:59:17 +0200
Subject: [PATCH 01/12] CFLAGS: Add options.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 1378caf..9f84629 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@


 CC = gcc
-CFLAGS = -O2 -g -Wall -Wno-unused-but-set-variable
+CFLAGS = -std=gnu99 -O2 -g -Werror -W -Wall -Wno-unused-but-set-variable

 all: factor make-prime-list

-- 
1.7.12.363.g53284de


>From 6488446b1185498fed02984ac51a1068e0d3bc7c Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 11 Sep 2012 11:55:30 +0200
Subject: [PATCH 02/12] s/const static/static const/

---
 factor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/factor.c b/factor.c
index abca67c..98e298c 100644
--- a/factor.c
+++ b/factor.c
@@ -793,7 +793,7 @@ mp_factor_using_division (mpz_t t, struct mp_factors 
*factors)
 #endif

 /* Entry i contains (2i+1)^(-1) mod 2^8.  */
-const static unsigned char  binvert_table[128] =
+static const unsigned char  binvert_table[128] =
 {
   0x01, 0xAB, 0xCD, 0xB7, 0x39, 0xA3, 0xC5, 0xEF,
   0xF1, 0x1B, 0x3D, 0xA7, 0x29, 0x13, 0x35, 0xDF,
-- 
1.7.12.363.g53284de


>From d2b9e92f883f7817592d2cdbe338866dc9e94d49 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 11 Sep 2012 12:00:00 +0200
Subject: [PATCH 03/12] prime_2p: make r and k unsigned, and

millerrabin: make k unsigned; move decl of i into for stmt.
---
 factor.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/factor.c b/factor.c
index 98e298c..0c2999b 100644
--- a/factor.c
+++ b/factor.c
@@ -1038,7 +1038,6 @@ powm2 (uintmax_t *r1m,
 int
 millerrabin (uintmax_t n, uintmax_t ni, uintmax_t b, uintmax_t q, unsigned int 
k, uintmax_t one)
 {
-  unsigned int i;
   uintmax_t y, nm1;

   y = powm (b, q, n, ni, one);
@@ -1048,7 +1047,7 @@ millerrabin (uintmax_t n, uintmax_t ni, uintmax_t b, 
uintmax_t q, unsigned int k
   if (y == one || y == nm1)
     return 1;

-  for (i = 1; i < k; i++)
+  for (unsigned int i = 1; i < k; i++)
     {
       y = mulredc (y, y, n, ni);

@@ -1063,9 +1062,8 @@ millerrabin (uintmax_t n, uintmax_t ni, uintmax_t b, 
uintmax_t q, unsigned int k
 int
 millerrabin2 (const uintmax_t *np, uintmax_t ni,
              const uintmax_t *bp, const uintmax_t *qp,
-             int k, const uintmax_t *one)
+             unsigned int k, const uintmax_t *one)
 {
-  unsigned int i;
   uintmax_t y1, y0, nm1_1, nm1_0, r1m;

   y0 = powm2 (&r1m, bp, qp, np, ni, one);
@@ -1079,7 +1077,7 @@ millerrabin2 (const uintmax_t *np, uintmax_t ni,
   if (y0 == nm1_0 && y1 == nm1_1)
     return 1;

-  for (i = 1; i < k; i++)
+  for (unsigned int i = 1; i < k; i++)
     {
       y0 = mulredc2 (&r1m, y1, y0, y1, y0, np[1], np[0], ni);
       y1 = r1m;
@@ -1206,7 +1204,7 @@ prime2_p (uintmax_t n1, uintmax_t n0)
   uintmax_t one[2];
   uintmax_t na[2];
   uintmax_t ni;
-  int k, r;
+  unsigned int k, r;
   struct factors factors;

   if (n1 == 0)
-- 
1.7.12.363.g53284de


>From 97d8c18730bd0dbed254ea64f29416c662cf772d Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 11 Sep 2012 12:25:51 +0200
Subject: [PATCH 04/12] move index decl into "for" stmt

---
 factor.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/factor.c b/factor.c
index 0c2999b..0ef3667 100644
--- a/factor.c
+++ b/factor.c
@@ -1904,12 +1904,11 @@ factor_using_squfof (uintmax_t n1, uintmax_t n0, struct 
factors *factors)
          else
            {
              struct factors f;
-             unsigned i;

              f.nfactors = 0;
              factor_using_squfof (0, S, &f);
              /* Duplicate the new factors */
-             for (i = 0; i < f.nfactors; i++)
+             for (unsigned int i = 0; i < f.nfactors; i++)
                factor_insert_multiplicity (factors, f.p[i], 2*f.e[i]);
            }
          return;
-- 
1.7.12.363.g53284de


>From a0994e20ccbce4330fdd3a065e3db6fb43659b5e Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 6 Sep 2012 22:40:46 +0200
Subject: [PATCH 05/12] strto2uintmax: avoid signed/unsigned mismatch warning

---
 factor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/factor.c b/factor.c
index 0ef3667..e3e5ee7 100644
--- a/factor.c
+++ b/factor.c
@@ -2182,7 +2182,7 @@ strto2uintmax (uintmax_t *hip, uintmax_t *lop, const char 
*s)
 {
   int errcode;
   int c;
-  int lo_carry;
+  unsigned int lo_carry;
   uintmax_t hi, lo;

   hi = lo = 0;
-- 
1.7.12.363.g53284de


>From 4ba89941c2eae13ab3418bf4dc839a41535260b1 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 11 Sep 2012 12:27:28 +0200
Subject: [PATCH 06/12] prime_p: avoid signed/unsigned comparison warning

---
 factor.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/factor.c b/factor.c
index e3e5ee7..ff56b34 100644
--- a/factor.c
+++ b/factor.c
@@ -1119,7 +1119,7 @@ mp_millerrabin (mpz_srcptr n, mpz_srcptr nm1, mpz_ptr x, 
mpz_ptr y,
 int
 prime_p (uintmax_t n)
 {
-  int k, r, is_prime;
+  int k, is_prime;
   uintmax_t q, a, a_prim, one, ni;
   struct factors factors;

@@ -1152,7 +1152,7 @@ prime_p (uintmax_t n)

   /* Loop until Lucas proves our number prime, or Miller-Rabin proves our
      number composite.  */
-  for (r = 0; r < PRIMES_PTAB_ENTRIES; r++)
+  for (unsigned int r = 0; r < PRIMES_PTAB_ENTRIES; r++)
     {
       int i;

-- 
1.7.12.363.g53284de


>From d22cf07c4eb7e4da736d3230cfa29515742611b3 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 6 Sep 2012 22:42:49 +0200
Subject: [PATCH 07/12] factor_using_squfof: (MERGE w/prev) avoid
 signed/unsigned compare warning

---
 factor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/factor.c b/factor.c
index ff56b34..c49ab0b 100644
--- a/factor.c
+++ b/factor.c
@@ -1908,7 +1908,7 @@ factor_using_squfof (uintmax_t n1, uintmax_t n0, struct 
factors *factors)
              f.nfactors = 0;
              factor_using_squfof (0, S, &f);
              /* Duplicate the new factors */
-             for (unsigned int i = 0; i < f.nfactors; i++)
+             for (int i = 0; i < f.nfactors; i++)
                factor_insert_multiplicity (factors, f.p[i], 2*f.e[i]);
            }
          return;
-- 
1.7.12.363.g53284de


>From d242b192b3b2d22f2040cd5260fa7de0785bd550 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 6 Sep 2012 22:45:45 +0200
Subject: [PATCH 08/12] strto2uintmax: avoid signed/unsigned compare warning

---
 factor.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/factor.c b/factor.c
index c49ab0b..b3a4ca9 100644
--- a/factor.c
+++ b/factor.c
@@ -2181,14 +2181,13 @@ int
 strto2uintmax (uintmax_t *hip, uintmax_t *lop, const char *s)
 {
   int errcode;
-  int c;
   unsigned int lo_carry;
   uintmax_t hi, lo;

   hi = lo = 0;
   for (;;)
     {
-      c = *s++;
+      unsigned char c = *s++;
       if (c == 0)
        break;

-- 
1.7.12.363.g53284de


>From 235f5a220f03d44f94222334bc832d738325c8a6 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 6 Sep 2012 23:00:10 +0200
Subject: [PATCH 09/12] HIGHBIT_TO_MASK: avoid signed/unsigned warning:

Cast 2nd operand of ternary operator to uintmax_t, to match
the type of the third operand.
---
 factor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/factor.c b/factor.c
index b3a4ca9..7b9e50d 100644
--- a/factor.c
+++ b/factor.c
@@ -342,7 +342,7 @@ void factor (uintmax_t, uintmax_t, struct factors *);

 #define HIGHBIT_TO_MASK(x)                                             \
   (((intmax_t)-1 >> 1) < 0                                             \
-   ? ((intmax_t)(x) >> (W_TYPE_SIZE - 1))                              \
+   ? (uintmax_t)((intmax_t)(x) >> (W_TYPE_SIZE - 1))                   \
    : ((x) & ((uintmax_t) 1 << (W_TYPE_SIZE - 1))                       \
       ? UINTMAX_MAX : (uintmax_t) 0))

-- 
1.7.12.363.g53284de


>From 19fc1e4bf36efef4153e49be7703bb3ea425308f Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 11 Sep 2012 13:50:10 +0200
Subject: [PATCH 10/12] run tests in parallel; put expected SHA in Makefile

---
 Makefile      | 84 +++++++++++++++++++++++++++--------------------------------
 tests/b0.sha  |  1 -
 tests/b1.sha  |  1 -
 tests/b10.sha |  1 -
 tests/b2.sha  |  1 -
 tests/b3.sha  |  1 -
 tests/b4.sha  |  1 -
 tests/b5.sha  |  1 -
 tests/b6.sha  |  1 -
 tests/b7.sha  |  1 -
 tests/b8.sha  |  1 -
 tests/b9.sha  |  1 -
 tests/h1.sha  |  1 -
 tests/q1.sha  |  1 -
 tests/q2.sha  |  1 -
 tests/q3.sha  |  1 -
 tests/q4.sha  |  1 -
 tests/q5.sha  |  1 -
 tests/s0.sha  |  1 -
 tests/s1.sha  |  1 -
 tests/s2.sha  |  1 -
 tests/s3.sha  |  1 -
 tests/s4.sha  |  1 -
 tests/s5.sha  |  1 -
 tests/s6.sha  |  1 -
 tests/s7.sha  |  1 -
 tests/s8.sha  |  1 -
 tests/s9.sha  |  1 -
 28 files changed, 39 insertions(+), 72 deletions(-)
 delete mode 100644 tests/b0.sha
 delete mode 100644 tests/b1.sha
 delete mode 100644 tests/b10.sha
 delete mode 100644 tests/b2.sha
 delete mode 100644 tests/b3.sha
 delete mode 100644 tests/b4.sha
 delete mode 100644 tests/b5.sha
 delete mode 100644 tests/b6.sha
 delete mode 100644 tests/b7.sha
 delete mode 100644 tests/b8.sha
 delete mode 100644 tests/b9.sha
 delete mode 100644 tests/h1.sha
 delete mode 100644 tests/q1.sha
 delete mode 100644 tests/q2.sha
 delete mode 100644 tests/q3.sha
 delete mode 100644 tests/q4.sha
 delete mode 100644 tests/q5.sha
 delete mode 100644 tests/s0.sha
 delete mode 100644 tests/s1.sha
 delete mode 100644 tests/s2.sha
 delete mode 100644 tests/s3.sha
 delete mode 100644 tests/s4.sha
 delete mode 100644 tests/s5.sha
 delete mode 100644 tests/s6.sha
 delete mode 100644 tests/s7.sha
 delete mode 100644 tests/s8.sha
 delete mode 100644 tests/s9.sha

diff --git a/Makefile b/Makefile
index 9f84629..107a53c 100644
--- a/Makefile
+++ b/Makefile
@@ -43,51 +43,45 @@ clean:
 # Use make check CHECK_FLAGS=-s to check squfof
 CHECK_FLAGS=

-check: factor ourseq
-       ./ourseq 0 1000000         | ./factor $(CHECK_FLAGS) | shasum -c 
--status tests/s0.sha
-       ./ourseq 18446744073709541616 18446744073709551615 \
-               | ./factor $(CHECK_FLAGS) | shasum -c --status tests/b0.sha
-       ./ourseq        0 10000000 | ./factor $(CHECK_FLAGS) | shasum -c 
--status tests/s1.sha
-       ./ourseq 10000000 20000000 | ./factor $(CHECK_FLAGS) | shasum -c 
--status tests/s2.sha
-       ./ourseq 20000000 30000000 | ./factor $(CHECK_FLAGS) | shasum -c 
--status tests/s3.sha
-       ./ourseq 30000000 40000000 | ./factor $(CHECK_FLAGS) | shasum -c 
--status tests/s4.sha
-       ./ourseq 40000000 50000000 | ./factor $(CHECK_FLAGS) | shasum -c 
--status tests/s5.sha
-       ./ourseq 50000000 60000000 | ./factor $(CHECK_FLAGS) | shasum -c 
--status tests/s6.sha
-       ./ourseq 60000000 70000000 | ./factor $(CHECK_FLAGS) | shasum -c 
--status tests/s7.sha
-       ./ourseq 70000000 80000000 | ./factor $(CHECK_FLAGS) | shasum -c 
--status tests/s8.sha
-       ./ourseq 80000000 90000000 | ./factor $(CHECK_FLAGS) | shasum -c 
--status tests/s9.sha
-       ./ourseq 18446744073708551616 18446744073708651615 \
-               | ./factor $(CHECK_FLAGS) | shasum -c --status tests/b1.sha
-       ./ourseq 18446744073708651616 18446744073708751615 \
-               | ./factor $(CHECK_FLAGS) | shasum -c --status tests/b2.sha
-       ./ourseq 18446744073708751616 18446744073708851615 \
-               | ./factor $(CHECK_FLAGS) | shasum -c --status tests/b3.sha
-       ./ourseq 18446744073708851616 18446744073708951615 \
-               | ./factor $(CHECK_FLAGS) | shasum -c --status tests/b4.sha
-       ./ourseq 18446744073708951616 18446744073709051615 \
-               | ./factor $(CHECK_FLAGS) | shasum -c --status tests/b5.sha
-       ./ourseq 18446744073709051616 18446744073709151615 \
-               | ./factor $(CHECK_FLAGS) | shasum -c --status tests/b6.sha
-       ./ourseq 18446744073709151616 18446744073709251615 \
-               | ./factor $(CHECK_FLAGS) | shasum -c --status tests/b7.sha
-       ./ourseq 18446744073709251616 18446744073709351615 \
-               | ./factor $(CHECK_FLAGS) | shasum -c --status tests/b8.sha
-       ./ourseq 18446744073709351616 18446744073709451615 \
-               | ./factor $(CHECK_FLAGS) | shasum -c --status tests/b9.sha
-       ./ourseq 18446744073709451616 18446744073709551615 \
-               | ./factor $(CHECK_FLAGS) | shasum -c --status tests/b10.sha
-       ./ourseq 18446744073709551616 18446744073709651615 \
-               | ./factor $(CHECK_FLAGS) | shasum -c --status tests/q1.sha
-       ./ourseq 18446744073709651616 18446744073709751615 \
-               | ./factor $(CHECK_FLAGS) | shasum -c --status tests/q2.sha
-       ./ourseq 18446744073709751616 18446744073709851615 \
-               | ./factor $(CHECK_FLAGS) | shasum -c --status tests/q3.sha
-       ./ourseq 18446744073709851616 18446744073709951615 \
-               | ./factor $(CHECK_FLAGS) | shasum -c --status tests/q4.sha
-       ./ourseq 18446744073709951616 18446744073710051615 \
-               | ./factor $(CHECK_FLAGS) | shasum -c --status tests/q5.sha
-       ./ourseq 79228162514264337593543850336 79228162514264337593543860335 \
-               | ./factor $(CHECK_FLAGS) | shasum -c --status tests/h1.sha
+p = 1844674407370
+q = 792281625142643375935438
+
+args = $(word 2,$(subst -, ,$@)) $(word 3,$(subst -, ,$@))
+tests = \
+  t-0-10000000-a451244522b1b662c86cb3cbb55aee3e085a61a0 \
+  t-10000000-20000000-c792a2e02f1c8536b5121f624b04039d20187016 \
+  t-20000000-30000000-8115e8dff97d1674134ec054598d939a2a5f6113 \
+  t-30000000-40000000-fe7b832c8e0ed55035152c0f9ebd59de73224a60 \
+  t-40000000-50000000-b8786d66c432e48bc5b342ee3c6752b7f096f206 \
+  t-50000000-60000000-a74fe518c5f79873c2b9016745b88b42c8fd3ede \
+  t-60000000-70000000-689bc70d681791e5d1b8ac1316a05d0c4473d6db \
+  t-70000000-80000000-d370808f2ab8c865f64c2ff909c5722db5b7d58d \
+  t-80000000-90000000-7978aa66bf2bdb446398336ea6f02605e9a77581 \
+  t-$(p)8551616-$(p)8651615-66c57cd58f4fb572df7f088d17e4f4c1d4f01bb1 \
+  t-$(p)8551616-$(p)8651615-66c57cd58f4fb572df7f088d17e4f4c1d4f01bb1 \
+  t-$(p)8651616-$(p)8751615-729228e693b1a568ecc85b199927424c7d16d410 \
+  t-$(p)8751616-$(p)8851615-5a0c985017c2d285e4698f836f5a059e0b684563 \
+  t-$(p)8851616-$(p)8951615-0482295c514e371c98ce9fd335deed0c9c44a4f4 \
+  t-$(p)8951616-$(p)9051615-9c0e1105ac7c45e27e7bbeb5e213f530d2ad1a71 \
+  t-$(p)9051616-$(p)9151615-604366d2b1d75371d0679e6a68962d66336cd383 \
+  t-$(p)9151616-$(p)9251615-9192d2bdee930135b28d7160e6d395a7027871da \
+  t-$(p)9251616-$(p)9351615-bcf56ae55d20d700690cff4d3327b78f83fc01bf \
+  t-$(p)9351616-$(p)9451615-16b106398749e5f24d278ba7c58229ae43f650ac \
+  t-$(p)9451616-$(p)9551615-ad2c6ed63525f8e7c83c4c416e7715fa1bebc54c \
+  t-$(p)9551616-$(p)9651615-2b6f9c11742d9de045515a6627c27a042c49f8ba \
+  t-$(p)9651616-$(p)9751615-54851acd51c4819beb666e26bc0100dc9adbc310 \
+  t-$(p)9751616-$(p)9851615-6939c2a7afd2d81f45f818a159b7c5226f83a50b \
+  t-$(p)9851616-$(p)9951615-0f2c8bc011d2a45e2afa01459391e68873363c6c \
+  t-$(p)9951616-18446744073710051615-630dc2ad72f4c222bad1405e6c5bea590f92a98c \
+  t-$(q)50336-$(q)60335-51ccb201e35599d545cb942e2bb31aba5bce4fc5
+
+$(tests): factor ourseq
+       @echo '$(lastword $(subst -, ,$@))  -' > exp.$@
+       @echo $(args)
+       @./ourseq $(args) | ./factor $(CHECK_FLAGS) | shasum -c --status exp.$@
+       @rm exp.$@
+
+check: $(tests) factor ourseq

 ver = `cat ver`
 dist:
diff --git a/tests/b0.sha b/tests/b0.sha
deleted file mode 100644
index 2811aa7..0000000
--- a/tests/b0.sha
+++ /dev/null
@@ -1 +0,0 @@
-28cc641760150f6bd378c27c6f810c8a4a9792d8  -
diff --git a/tests/b1.sha b/tests/b1.sha
deleted file mode 100644
index 64a6025..0000000
--- a/tests/b1.sha
+++ /dev/null
@@ -1 +0,0 @@
-66c57cd58f4fb572df7f088d17e4f4c1d4f01bb1  -
diff --git a/tests/b10.sha b/tests/b10.sha
deleted file mode 100644
index a5bf947..0000000
--- a/tests/b10.sha
+++ /dev/null
@@ -1 +0,0 @@
-ad2c6ed63525f8e7c83c4c416e7715fa1bebc54c  -
diff --git a/tests/b2.sha b/tests/b2.sha
deleted file mode 100644
index 29c5e6a..0000000
--- a/tests/b2.sha
+++ /dev/null
@@ -1 +0,0 @@
-729228e693b1a568ecc85b199927424c7d16d410  -
diff --git a/tests/b3.sha b/tests/b3.sha
deleted file mode 100644
index b8b0a56..0000000
--- a/tests/b3.sha
+++ /dev/null
@@ -1 +0,0 @@
-5a0c985017c2d285e4698f836f5a059e0b684563  -
diff --git a/tests/b4.sha b/tests/b4.sha
deleted file mode 100644
index 9ff8dad..0000000
--- a/tests/b4.sha
+++ /dev/null
@@ -1 +0,0 @@
-0482295c514e371c98ce9fd335deed0c9c44a4f4  -
diff --git a/tests/b5.sha b/tests/b5.sha
deleted file mode 100644
index d577478..0000000
--- a/tests/b5.sha
+++ /dev/null
@@ -1 +0,0 @@
-9c0e1105ac7c45e27e7bbeb5e213f530d2ad1a71  -
diff --git a/tests/b6.sha b/tests/b6.sha
deleted file mode 100644
index f8d57e6..0000000
--- a/tests/b6.sha
+++ /dev/null
@@ -1 +0,0 @@
-604366d2b1d75371d0679e6a68962d66336cd383  -
diff --git a/tests/b7.sha b/tests/b7.sha
deleted file mode 100644
index 69997c4..0000000
--- a/tests/b7.sha
+++ /dev/null
@@ -1 +0,0 @@
-9192d2bdee930135b28d7160e6d395a7027871da  -
diff --git a/tests/b8.sha b/tests/b8.sha
deleted file mode 100644
index 10aac6b..0000000
--- a/tests/b8.sha
+++ /dev/null
@@ -1 +0,0 @@
-bcf56ae55d20d700690cff4d3327b78f83fc01bf  -
diff --git a/tests/b9.sha b/tests/b9.sha
deleted file mode 100644
index 8859f9f..0000000
--- a/tests/b9.sha
+++ /dev/null
@@ -1 +0,0 @@
-16b106398749e5f24d278ba7c58229ae43f650ac  -
diff --git a/tests/h1.sha b/tests/h1.sha
deleted file mode 100644
index 3ce3865..0000000
--- a/tests/h1.sha
+++ /dev/null
@@ -1 +0,0 @@
-51ccb201e35599d545cb942e2bb31aba5bce4fc5  -
diff --git a/tests/q1.sha b/tests/q1.sha
deleted file mode 100644
index 3bc8e2a..0000000
--- a/tests/q1.sha
+++ /dev/null
@@ -1 +0,0 @@
-2b6f9c11742d9de045515a6627c27a042c49f8ba  -
diff --git a/tests/q2.sha b/tests/q2.sha
deleted file mode 100644
index c1c4ae4..0000000
--- a/tests/q2.sha
+++ /dev/null
@@ -1 +0,0 @@
-54851acd51c4819beb666e26bc0100dc9adbc310  -
diff --git a/tests/q3.sha b/tests/q3.sha
deleted file mode 100644
index 49a29e9..0000000
--- a/tests/q3.sha
+++ /dev/null
@@ -1 +0,0 @@
-6939c2a7afd2d81f45f818a159b7c5226f83a50b  -
diff --git a/tests/q4.sha b/tests/q4.sha
deleted file mode 100644
index 7922917..0000000
--- a/tests/q4.sha
+++ /dev/null
@@ -1 +0,0 @@
-0f2c8bc011d2a45e2afa01459391e68873363c6c  -
diff --git a/tests/q5.sha b/tests/q5.sha
deleted file mode 100644
index 9d4f028..0000000
--- a/tests/q5.sha
+++ /dev/null
@@ -1 +0,0 @@
-630dc2ad72f4c222bad1405e6c5bea590f92a98c  -
diff --git a/tests/s0.sha b/tests/s0.sha
deleted file mode 100644
index 3a8136d..0000000
--- a/tests/s0.sha
+++ /dev/null
@@ -1 +0,0 @@
-fe06c03e8dcaeee1cb3d657e56047a190c766d46  -
diff --git a/tests/s1.sha b/tests/s1.sha
deleted file mode 100644
index 41cccdc..0000000
--- a/tests/s1.sha
+++ /dev/null
@@ -1 +0,0 @@
-a451244522b1b662c86cb3cbb55aee3e085a61a0  -
diff --git a/tests/s2.sha b/tests/s2.sha
deleted file mode 100644
index c829df7..0000000
--- a/tests/s2.sha
+++ /dev/null
@@ -1 +0,0 @@
-c792a2e02f1c8536b5121f624b04039d20187016  -
diff --git a/tests/s3.sha b/tests/s3.sha
deleted file mode 100644
index fb8effc..0000000
--- a/tests/s3.sha
+++ /dev/null
@@ -1 +0,0 @@
-8115e8dff97d1674134ec054598d939a2a5f6113  -
diff --git a/tests/s4.sha b/tests/s4.sha
deleted file mode 100644
index f744178..0000000
--- a/tests/s4.sha
+++ /dev/null
@@ -1 +0,0 @@
-fe7b832c8e0ed55035152c0f9ebd59de73224a60  -
diff --git a/tests/s5.sha b/tests/s5.sha
deleted file mode 100644
index 61ae911..0000000
--- a/tests/s5.sha
+++ /dev/null
@@ -1 +0,0 @@
-b8786d66c432e48bc5b342ee3c6752b7f096f206  -
diff --git a/tests/s6.sha b/tests/s6.sha
deleted file mode 100644
index 0f7f250..0000000
--- a/tests/s6.sha
+++ /dev/null
@@ -1 +0,0 @@
-a74fe518c5f79873c2b9016745b88b42c8fd3ede  -
diff --git a/tests/s7.sha b/tests/s7.sha
deleted file mode 100644
index 76f5159..0000000
--- a/tests/s7.sha
+++ /dev/null
@@ -1 +0,0 @@
-689bc70d681791e5d1b8ac1316a05d0c4473d6db  -
diff --git a/tests/s8.sha b/tests/s8.sha
deleted file mode 100644
index ad84d82..0000000
--- a/tests/s8.sha
+++ /dev/null
@@ -1 +0,0 @@
-d370808f2ab8c865f64c2ff909c5722db5b7d58d  -
diff --git a/tests/s9.sha b/tests/s9.sha
deleted file mode 100644
index 2cfe601..0000000
--- a/tests/s9.sha
+++ /dev/null
@@ -1 +0,0 @@
-7978aa66bf2bdb446398336ea6f02605e9a77581  -
-- 
1.7.12.363.g53284de


>From d88087d9f4ac1b1e767be6f6547a28e5a01641ff Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 11 Sep 2012 14:27:18 +0200
Subject: [PATCH 11/12] adjust comment wording

---
 factor.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/factor.c b/factor.c
index 7b9e50d..b7cfcbf 100644
--- a/factor.c
+++ b/factor.c
@@ -18,8 +18,8 @@ PARTICULAR PURPOSE.  See the GNU General Public License for 
more details.
 You should have received a copy of the GNU General Public License along with
 this program.  If not, see http://www.gnu.org/licenses/.  */

-/* Factor efficiently numbers that fit in one or two words (word = uintmax_t),
-   of with GMP numbers of any size.
+/* Efficiently factor numbers that fit in one or two words (word = uintmax_t),
+   or, with GMP, numbers of any size.

   Code organisation:

-- 
1.7.12.363.g53284de


>From 509bc134f8a3c603ac338f67c1ad0127ae29fbe3 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 11 Sep 2012 14:27:53 +0200
Subject: [PATCH 12/12] factor_insert_refind: make "off" unsigned, not int

---
 factor.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/factor.c b/factor.c
index b7cfcbf..59a4e73 100644
--- a/factor.c
+++ b/factor.c
@@ -623,9 +623,10 @@ int flag_prove_primality = 1;
 #define UNLIKELY(cond)  __builtin_expect ((cond) != 0, 0)

 void
-factor_insert_refind (struct factors *factors, uintmax_t p, unsigned int i, 
int off)
+factor_insert_refind (struct factors *factors, uintmax_t p, unsigned int i,
+                     unsigned int off)
 {
-  int j;
+  unsigned int j;
   for (j = 0; j < off; j++)
     p += primes_diff[i + j];
   factor_insert (factors, p);
-- 
1.7.12.363.g53284de


reply via email to

[Prev in Thread] Current Thread [Next in Thread]