[libmath-prime-util-perl] 171/181: Fix MSC support for ctz/clz, hopefully

Partha P. Mukherjee ppm-guest at moszumanska.debian.org
Thu May 21 18:51:18 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 441bbd93c8df5c32ebe91c693fcbc44bce621fb7
Author: Dana Jacobsen <dana at acm.org>
Date:   Sun Jan 12 16:06:26 2014 -0800

    Fix MSC support for ctz/clz, hopefully
---
 TODO   | 25 ++++++++++++++++++++++++-
 util.h | 10 ++++++++--
 2 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/TODO b/TODO
index 2150c53..667e4c7 100644
--- a/TODO
+++ b/TODO
@@ -60,7 +60,6 @@
     - Variable sieve size
     - look at sieve.c style prime walking
 
-- Add Inverse Li and Legendre Phi to API?
 
 - Iterators speedup:
   1) config option for sieved next_prime.  Very general, would make
@@ -70,3 +69,27 @@
 
 - Perhaps have main segment know the filled in range.  That would allow
   a sieved next_prime, and might speed up some counts and the like.
+
+- Consider exporting is_bpsw_prime
+
+- Add Inverse Li to API?
+
+- Benchmark simple SoEs, SoA.  Include Sisyphus SoE hidden in Math::GMPz.
+
+- Redo trial vs. segment test in Util.pm primes().
+
+- commit Porter example
+
+- Try using malloc/free for win32 cache memory.  #define NO_XSLOCKS
+
+- Investigate optree constant folding in PP compilation for performance.
+  Use B::Deparse to check.
+
+- Move more functions from _generic_... to PP::
+
+- Ensure a fast path for Math::GMP from MPU -> MPU:GMP -> GMP, and back.
+
+- znlog bignum tests, znlog better implementation
+
+- Make a test that takes each function with a Pari equivalent, constructs
+  random arguments, and compares.  Loop over all functions.
diff --git a/util.h b/util.h
index e92e32c..8627110 100644
--- a/util.h
+++ b/util.h
@@ -127,7 +127,13 @@ static int is_perfect_square(UV n)
   #define clz(n)        ((n) ?    __builtin_clzl(n) : 32)
   #define log2floor(n)  ((n) ? 31-__builtin_clzl(n) : 0)
  #endif
-#elif defined (_MSC_VER)
+
+ /* For MSC, we need to use _BitScanForward and _BitScanReverse.  The way to
+  * get to them has changed, so we're going to only use them on new systems.
+  * The performance of these functions are not super critical.
+  * What is:  popcnt, mulmod, and muladd.
+  */
+#elif defined (_MSC_VER) && _MSC_VER >= 1400
  #include <intrin.h>
  #ifdef FUNC_ctz
   static int ctz(UV n) {
@@ -170,7 +176,7 @@ static int is_perfect_square(UV n)
 #else
  #ifdef FUNC_ctz
    static const unsigned char _trail_debruijn32[32] = {
-      0, 1,28, 2,29,14,24, 3,30,22,20,15,25,17, 4, 8, 
+      0, 1,28, 2,29,14,24, 3,30,22,20,15,25,17, 4, 8,
      31,27,13,23,21,19,16, 7,26,12,18, 6,11, 5,10, 9 };
    static unsigned int ctz(UV n) {
      return n ? _trail_debruijn32[((n & -n) * UVCONST(0x077CB531)) >> 27] : 32;

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