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

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

commit b3e35faa723f93d6f47954a0848fdbe5cb6864cf
Author: Dana Jacobsen <d...@acm.org>
Date:   Sat Oct 27 18:48:45 2012 -0700

    Speed up powmod a tiny bit
---
 lib/Math/Prime/Util/PP.pm | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/Math/Prime/Util/PP.pm b/lib/Math/Prime/Util/PP.pm
index 515b9fb..0cf7657 100644
--- a/lib/Math/Prime/Util/PP.pm
+++ b/lib/Math/Prime/Util/PP.pm
@@ -493,9 +493,9 @@ sub _native_powmod {
   my $t = 1;
   $n = $n % $m;
   while ($power) {
-    $t = ($t * $n) % $m if ($power & 1) != 0;
-    $n = ($n * $n) % $m;
+    $t = ($t * $n) % $m if ($power & 1);
     $power >>= 1;
+    $n = ($n * $n) % $m if $power;
   }
   $t;
 }
@@ -507,15 +507,15 @@ sub _powmod {
   if  ($m < $_half_word) {
     $n %= $m;
     while ($power) {
-      $t = ($t * $n) % $m if ($power & 1) != 0;
-      $n = ($n * $n) % $m;
+      $t = ($t * $n) % $m if ($power & 1);
       $power >>= 1;
+      $n = ($n * $n) % $m if $power;
     }
   } else {
     while ($power) {
-      $t = _mulmod($t, $n, $m) if ($power & 1) != 0;
-      $n = _mulmod($n, $n, $m);
+      $t = _mulmod($t, $n, $m) if ($power & 1);
       $power >>= 1;
+      $n = _mulmod($n, $n, $m) if $power;
     }
   }
   $t;

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