[libmath-prime-util-perl] 13/54: Code movement

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


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

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

commit 6600baf83e2201596e335e5274d5e71573d36db2
Author: Dana Jacobsen <dana at acm.org>
Date:   Fri Jan 31 01:00:28 2014 -0800

    Code movement
---
 TODO   | 6 ------
 util.c | 9 ++++-----
 2 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/TODO b/TODO
index 904b6ca..021d8b0 100644
--- a/TODO
+++ b/TODO
@@ -6,10 +6,6 @@
   * Test on 32-bit Perl.  Test on Win32.
 
 
-- Figure out documentation solution for PP.pm
-
-- Is the current PP.pm setup the way we want to do it?
-
 - Move .c / .h files into separate directory.
   version does it in a painful way.  Something simpler to be had?
 
@@ -64,8 +60,6 @@
 
 - Benchmark simple SoEs, SoA.  Include Sisyphus SoE hidden in Math::GMPz.
 
-- commit Porter example
-
 - Try using malloc/free for win32 cache memory.  #define NO_XSLOCKS
 
 - Investigate optree constant folding in PP compilation for performance.
diff --git a/util.c b/util.c
index c681dc6..f86c103 100644
--- a/util.c
+++ b/util.c
@@ -638,9 +638,6 @@ UV prime_count_upper(UV n)
 
   if (n < 33000) return _XS_prime_count(2, n);
 
-  fn     = (long double) n;
-  flogn  = logl(n);
-
   for (i = 0; i < (int)NUPPER_THRESH; i++)
     if (n < _upper_thresh[i].thresh)
       break;
@@ -648,6 +645,8 @@ UV prime_count_upper(UV n)
   if (i < (int)NUPPER_THRESH) a = _upper_thresh[i].aval;
   else                        a = 2.334;   /* Dusart 2010, page 2 */
 
+  fn     = (long double) n;
+  flogn  = logl(n);
   upper = fn/flogn * (1.0 + 1.0/flogn + a/(flogn*flogn));
   return (UV) ceill(upper);
 }
@@ -1049,8 +1048,8 @@ int is_power(UV n, UV a)
         return (r5*r5*r5*r5*r5 == n) ? is_power(r5, a/5) : 0; }
   }
   ret = powerof(n);
-  if (a == 0 && ret == 1) ret = 0;
-  return (a == 0) ? ret : !(ret % a);
+  if (a != 0) return !(ret % a);  /* Is the max power divisible by a? */
+  return (ret == 1) ? 0 : ret;
 }
 
 

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