[libmath-prime-util-perl] 136/181: Small aks speedup
Partha P. Mukherjee
ppm-guest at moszumanska.debian.org
Thu May 21 18:51:14 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 2b100bd456bf93b796e737dd7f78b077edf639e9
Author: Dana Jacobsen <dana at acm.org>
Date: Wed Jan 8 03:00:28 2014 -0800
Small aks speedup
---
aks.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/aks.c b/aks.c
index 1a0571c..2201e76 100644
--- a/aks.c
+++ b/aks.c
@@ -170,14 +170,16 @@ static void poly_mod_sqr(UV* px, UV* res, UV r, UV mod)
maxpx = s;
/* 1D convolution */
for (d = 0; d <= 2*degree; d++) {
+ UV *pp1, *pp2, *ppend;
UV s_beg = (d <= degree) ? 0 : d-degree;
UV s_end = ((d/2) <= maxpx) ? d/2 : maxpx;
if (s_end < s_beg) continue;
sum = 0;
- for (s = s_beg; s < s_end; s++) {
- c = px[s];
- sum += 2*c * px[d-s];
- }
+ pp1 = px + s_beg;
+ pp2 = px + d - s_beg;
+ ppend = px + s_end;
+ while (pp1 < ppend)
+ sum += 2 * *pp1++ * *pp2--;
/* Special treatment for last point */
c = px[s_end];
sum += (s_end*2 == d) ? c*c : 2*c*px[d-s_end];
--
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