[libmath-prime-util-perl] 12/50: If using the GMP module for primes(), convert the result to BigInts
Partha P. Mukherjee
ppm-guest at moszumanska.debian.org
Thu May 21 18:45:33 UTC 2015
This is an automated email from the git hooks/post-receive script.
ppm-guest pushed a commit to annotated tag v0.13
in repository libmath-prime-util-perl.
commit 0ba452dec2648e712e5a1ca3dccc9ab33215902a
Author: Dana Jacobsen <dana at acm.org>
Date: Tue Oct 16 04:23:50 2012 -0600
If using the GMP module for primes(), convert the result to BigInts
---
lib/Math/Prime/Util.pm | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/lib/Math/Prime/Util.pm b/lib/Math/Prime/Util.pm
index 3ac7661..6e85e88 100644
--- a/lib/Math/Prime/Util.pm
+++ b/lib/Math/Prime/Util.pm
@@ -236,7 +236,13 @@ sub primes {
return $sref if ($low > $high) || ($high < 2);
if ($high > $_XS_MAXVAL) {
- return Math::Prime::Util::GMP::primes($low,$high) if $_HAVE_GMP;
+ if ($_HAVE_GMP) {
+ $sref = Math::Prime::Util::GMP::primes($low,$high);
+ # Convert the returned strings into BigInts
+ croak "Internal error: large value without bigint loaded." unless defined $Math::BigInt::VERSION;
+ @$sref = map { Math::BigInt->new("$_") } @$sref;
+ return $sref;
+ }
return Math::Prime::Util::PP::primes($low,$high);
}
--
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