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 e7fcbc365b5143d16a7266da591439d6e1d7d729
Author: Dana Jacobsen <d...@acm.org>
Date:   Tue Feb 11 11:43:11 2014 -0800

    More or less initial pbrent based on mulmod speed
---
 factor.c | 12 ++++++++----
 mulmod.h |  4 ++++
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/factor.c b/factor.c
index 3e02509..cce32fb 100644
--- a/factor.c
+++ b/factor.c
@@ -90,12 +90,16 @@ int factor(UV n, UV *factors)
 
   /* loop over each remaining factor, until ntofac == 0 */
   do {
-    //while ( (n >= f*f) && (!_XS_is_prime(n)) ) {
     while ( (n >= f*f) && (!is_prob_prime(n)) ) {
       int split_success = 0;
-      /* Adjust the number of rounds based on the number size */
-      UV const br_rounds = ((n>>29) < 100000) ?  1500 :  4000;
-      UV const sq_rounds =100000; /* 20k 91%, 40k 98%, 80k 99.9%, 120k 99.99% 
*/
+      /* Adjust the number of rounds based on the number size and speed */
+#if MULMODS_ARE_FAST
+      UV const br_rounds = ((n>>29) < 100000) ?  4000 :  6000;
+      UV const sq_rounds = 100000; /* 20k 91%, 40k 98%, 80k 99.9%, 120k 
99.99%*/
+#else
+      UV const br_rounds = ((n>>29) < 100000) ?   500 :  2000;
+      UV const sq_rounds = 150000;
+#endif
 
       /* 99.7% of 32-bit, 94% of 64-bit random inputs factored here */
       if (!split_success) {
diff --git a/mulmod.h b/mulmod.h
index b826e98..9c3ada0 100644
--- a/mulmod.h
+++ b/mulmod.h
@@ -13,6 +13,8 @@
 
 /* if n is smaller than this, you can multiply without overflow */
 #define HALF_WORD (UVCONST(1) << (BITS_PER_WORD/2))
+/* This will be true if we think mulmods are fast */
+#define MULMODS_ARE_FAST 1
 
 #if (BITS_PER_WORD == 32) && HAVE_STD_U64
 
@@ -76,6 +78,8 @@
 #else
 
   /* UV is the largest integral type available (that we know of). */
+#undef MULMODS_ARE_FAST
+#define MULMODS_ARE_FAST 0
 
   /* Do it by hand */
   static INLINE UV _mulmod(UV a, UV b, UV n) {

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

_______________________________________________
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits

Reply via email to