Skip to content

Commit

Permalink
perf: Another minor efficieincy tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregungory committed Mar 14, 2024
1 parent a4faad3 commit 34ad1ff
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/rt/data.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef lint
static const char RCSid[] = "$Id: data.c,v 2.40 2024/03/13 07:24:53 greg Exp $";
static const char RCSid[] = "$Id: data.c,v 2.41 2024/03/14 06:30:53 greg Exp $";
#endif
/*
* data.c - routines dealing with interpolated data.
Expand Down Expand Up @@ -433,7 +433,7 @@ data_interp(DATARRAY *dp, double *pt, double coef, DATATYPE *rvec)
i = dp->dim[0].ne - 2;
} else { /* unevenly spaced points */
int lower, upper;
if (dp->dim[0].siz > 0.0) {
if (dp->dim[0].siz > 0.) {
lower = 0;
upper = dp->dim[0].ne;
} else {
Expand Down Expand Up @@ -482,15 +482,15 @@ data_interp(DATARRAY *dp, double *pt, double coef, DATATYPE *rvec)
double f;
sd.arr.s = dp->arr.s + i*stride;
if ((sd.arr.s[sd.dim[0].ne] > 0) & ((-FTINY>c0)|(c0>FTINY))) {
f = c0*ldexp(1., (int)sd.arr.s[sd.dim[0].ne]-(COLXS+8));
f = ldexp(c0, (int)sd.arr.s[sd.dim[0].ne]-(COLXS+8));
for (i = sd.dim[0].ne; i--; )
rvec[i] += f*(sd.arr.s[i] + 0.5);
rvec[i] += f*(sd.arr.s[i] + .5);
}
sd.arr.s += stride;
if ((sd.arr.s[sd.dim[0].ne] > 0) & ((-FTINY>c1)|(c1>FTINY))) {
f = c1*ldexp(1., (int)sd.arr.s[sd.dim[0].ne]-(COLXS+8));
f = ldexp(c1, (int)sd.arr.s[sd.dim[0].ne]-(COLXS+8));
for (i = sd.dim[0].ne; i--; )
rvec[i] += f*(sd.arr.s[i] + 0.5);
rvec[i] += f*(sd.arr.s[i] + .5);
}
} else {
sd.arr.c = dp->arr.c + i*stride;
Expand Down Expand Up @@ -529,7 +529,7 @@ data_interp(DATARRAY *dp, double *pt, double coef, DATATYPE *rvec)
y0 = f*(dp->arr.s[i] + 0.5);
y1 = f*(dp->arr.s[i+1] + 0.5);
} else
y0 = y1 = 0.0;
y0 = y1 = 0.;
} else {
y0 = colrval(dp->arr.c[i],dp->type);
y1 = colrval(dp->arr.c[i+1],dp->type);
Expand Down

0 comments on commit 34ad1ff

Please sign in to comment.