[libmath-prime-util-perl] 55/55: PP next_prime much faster to return first bigint prime. Huge speedup for xt/primes-edgecases.pl

Partha P. Mukherjee ppm-guest at moszumanska.debian.org
Thu May 21 18:53:44 UTC 2015


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 355312a59f9a8ea0aa1a0f13646a1b9508d60bd7
Author: Dana Jacobsen <dana at acm.org>
Date:   Sun May 18 00:14:56 2014 -0700

    PP next_prime much faster to return first bigint prime.  Huge speedup for xt/primes-edgecases.pl
---
 Changes                   | 2 +-
 lib/Math/Prime/Util/PP.pm | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Changes b/Changes
index ad9016e..381094d 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,6 @@
 Revision history for Perl module Math::Prime::Util
 
-0.41  2014-05-17
+0.41  2014-05-18
 
     [ADDED]
 
diff --git a/lib/Math/Prime/Util/PP.pm b/lib/Math/Prime/Util/PP.pm
index 07a78b8..249878a 100644
--- a/lib/Math/Prime/Util/PP.pm
+++ b/lib/Math/Prime/Util/PP.pm
@@ -493,9 +493,9 @@ sub next_prime {
     return $_primes_small[$i+1];
   }
 
-
-  $n = Math::BigInt->new(''.$_[0])
-     if ref($n) ne 'Math::BigInt' && $n >= MPU_MAXPRIME;
+  return Math::BigInt->new(MPU_32BIT ? "4294967311" : "18446744073709551629")
+    if ref($n) ne 'Math::BigInt' && $n >= MPU_MAXPRIME;
+  # n is now either 1) not bigint and < maxprime, or (2) bigint and >= uvmax
 
   #$n = ($n+1) | 1;
   #while (    !($n%3) || !($n%5) || !($n%7) || !($n%11) || !($n%13)

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



More information about the Pkg-perl-cvs-commits mailing list