-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillacode-qualityenhancementImproving things as opposed to bug fixing, e.g. new or missing featureImproving things as opposed to bug fixing, e.g. new or missing featureloopoptim
Description
| Bugzilla Link | 714 |
| Resolution | FIXED |
| Resolved on | Sep 25, 2007 13:25 |
| Version | 1.0 |
| OS | All |
Extended Description
Consider this:
#include <math.h>
void test(float *x, long ndat, float **y, float xcen,
long xmin, long xmax, float sigmal,
float contribution) {
long i,k;
float diff;
for (i=xmin,k=0; i<=xmax; i++, k++) {
if(i >= 0 && i < ndat) {
diff = fabs(xcen - x[i])/sigmal;
y[0][k] += contribution * 0.5*exp(-diff)/sigmal;
}
}
}
Through index set analysis, the two if statements inside the loop (comparing i to 0/ndat) can be
hoisted out.
-Chris
Metadata
Metadata
Assignees
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillacode-qualityenhancementImproving things as opposed to bug fixing, e.g. new or missing featureImproving things as opposed to bug fixing, e.g. new or missing featureloopoptim