[libmath-prime-util-perl] 156/181: spacing

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


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

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

commit 5167498f738fd97a4505e984c2d10802fb857a7f
Author: Dana Jacobsen <dana at acm.org>
Date:   Thu Jan 9 17:05:11 2014 -0800

    spacing
---
 cpanfile                  | 1 +
 lib/Math/Prime/Util/PP.pm | 4 ++--
 util.c                    | 6 +++---
 util.h                    | 2 +-
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/cpanfile b/cpanfile
index b615c68..0cf2d5f 100644
--- a/cpanfile
+++ b/cpanfile
@@ -6,6 +6,7 @@ requires 'XSLoader', '0.01';
 requires 'Carp';
 requires 'Tie::Array';
 requires 'base';
+requires 'constant';
 requires 'Config';
 requires 'Math::BigInt', '1.88';
 requires 'Math::BigFloat', '1.59';
diff --git a/lib/Math/Prime/Util/PP.pm b/lib/Math/Prime/Util/PP.pm
index 1eaca36..ca5eebd 100644
--- a/lib/Math/Prime/Util/PP.pm
+++ b/lib/Math/Prime/Util/PP.pm
@@ -96,7 +96,7 @@ sub _validate_positive_integer {
   if (ref($n) eq 'Math::BigInt') {
     croak "Parameter '$n' must be a positive integer"
       if $n->sign() ne '+' || !$n->is_int();
-    $_[0] = _bigint_to_int($_[0]) 
+    $_[0] = _bigint_to_int($_[0])
       if $n <= (OLD_PERL_VERSION ? 562949953421312 : ''.~0);
   } else {
     my $strn = "$n";
@@ -105,7 +105,7 @@ sub _validate_positive_integer {
     if ($n <= (OLD_PERL_VERSION ? 562949953421312 : ''.~0)) {
       $_[0] = $strn if ref($n);
     } else {
-      $_[0] = Math::BigInt->new($strn) 
+      $_[0] = Math::BigInt->new($strn)
     }
   }
   $_[0]->upgrade(undef) if ref($_[0]) && $_[0]->upgrade();
diff --git a/util.c b/util.c
index 8d555c9..b31d587 100644
--- a/util.c
+++ b/util.c
@@ -66,6 +66,7 @@
 #define FUNC_isqrt 1
 #define FUNC_lcm_ui 1
 #define FUNC_ctz 1
+#define FUNC_log2floor 1
 #include "util.h"
 #include "sieve.h"
 #include "primality.h"
@@ -807,8 +808,7 @@ signed char* _moebius_range(UV lo, UV hi)
       A[i-lo] |= 0x80;
   } END_DO_FOR_EACH_PRIME
 
-  logp = 0; nextlog = lo;
-  while (nextlog >>= 1)  logp++;
+  logp = log2floor(lo);
   nextlog = 2UL << logp;
   for (i = lo; i <= hi; i++) {
     unsigned char a = A[i-lo];
@@ -1000,7 +1000,7 @@ UV exp_mangoldt(UV n) {
   else {
     UV i, factors[MPU_MAX_FACTORS+1];
     UV nfactors = factor(n, factors);
-    for (i = 1; i < nfactors; i++) 
+    for (i = 1; i < nfactors; i++)
       if (factors[i] != factors[0])
         return 1;
     return factors[0];
diff --git a/util.h b/util.h
index 59c1da3..0afdff7 100644
--- a/util.h
+++ b/util.h
@@ -123,7 +123,7 @@ static int is_perfect_square(UV n)
 /* log2floor(n) gives the location of the first set bit (starting from left)
  * ctz(n)       gives the number of times n is divisible by 2
  * clz(n)       gives the number of zeros on the left                       */
-#ifdef __GNUC__
+#if defined(__GNUC__)
  #if BITS_PER_WORD == 64
   #define ctz(n)        ((n) ?    __builtin_ctzll(n) : 64)
   #define clz(n)        ((n) ?    __builtin_clzll(n) : 64)

-- 
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