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

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

commit 2e07559e998f7db98b84de4b3c31e5a387cfb5c9
Author: Dana Jacobsen <d...@acm.org>
Date:   Tue Apr 22 15:02:10 2014 -0700

    Jordan totient even number shortcut
---
 util.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/util.c b/util.c
index 446e2fa..6ffba87 100644
--- a/util.c
+++ b/util.c
@@ -1344,6 +1344,9 @@ UV jordan_totient(UV k, UV n) {
   if (k > 6 || (k > 1 && n >= jordan_overflow[k-2])) return 0;
 
   totient = 1;
+  /* Similar to Euler totient, shortcut even inputs */
+  while ((n & 0x3) == 0) { n >>= 1; totient *= (1<<k); }
+  if ((n & 0x1) == 0) { n >>= 1; totient *= ((1<<k)-1); }
   nfac = factor(n,factors);
   for (i = 0; i < nfac; i++) {
     UV p = factors[i];

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