This is an automated email from the git hooks/post-receive script.

ppm-guest pushed a commit to annotated tag v0.41
in repository libmath-prime-util-perl.

commit c973a3911211d740a91c4b4d77df949fc3314f79
Author: Dana Jacobsen <d...@acm.org>
Date:   Fri May 2 14:02:34 2014 -0700

    Fix forcomposite with endpoint past max prime
---
 XS.xs | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/XS.xs b/XS.xs
index e36026b..77d4dbd 100644
--- a/XS.xs
+++ b/XS.xs
@@ -1115,7 +1115,7 @@ forcomposites (SV* block, IN SV* svbeg, IN SV* svend = 0)
       /* Find the two primes that bound their interval. */
       /* If beg or end are >= max_prime, then this will die. */
       prevprime = prev_prime(beg);
-      nextprime = next_prime(end);
+      nextprime = (end >= MPU_MAX_PRIME) ? MPU_MAX_PRIME : next_prime(end);
       ctx = start_segment_primes(beg, nextprime, &segment);
       while (next_segment_primes(ctx, &seg_base, &seg_low, &seg_high)) {
         START_DO_FOR_EACH_SIEVE_PRIME( segment, seg_low - seg_base, seg_high - 
seg_base ) {
@@ -1128,11 +1128,13 @@ forcomposites (SV* block, IN SV* svbeg, IN SV* svend = 
0)
         } END_DO_FOR_EACH_SIEVE_PRIME
       }
       end_segment_primes(ctx);
-      MPUassert( nextprime >= end, "composite sieve skipped end numbers" );
+      beg = nextprime + 1;
+      if (beg != MPU_MAX_PRIME+1)
+        MPUassert( beg >= end, "composite sieve skipped end numbers" );
       FIX_MULTICALL_REFCOUNT;
       POP_MULTICALL;
     }
-    else
+    /* Fall through to handle the edge case */
 #endif
     if (beg <= end) {
       beg = (beg <= 4) ? 3 : beg-1;

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libmath-prime-util-perl.git

_______________________________________________
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits

Reply via email to