Skip to content

Commit 4ce502c

Browse files
remove repetition by extra temp var
Co-authored-by: Benjamin Schwendinger <[email protected]>
1 parent 911968f commit 4ce502c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/froll.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,9 +399,10 @@ inline void wmax(double *x, uint64_t o, int k, double *w, uint64_t *iw, bool nar
399399
if (narm) {
400400
for (int i=0; i<k; i++) {
401401
//Rprintf("wmax iter %d, offset %d, first x val %f, testing x[o+i-k+1] >= w[0]: x[%d-%d+1] >= w[0]: %f >= %f: %d\n", i, o, x[o], i, k, x[o+i-k+1], w[0], x[o+i-k+1] >= w[0]);
402-
if (x[o+i-k+1] >= w[0]) { // this never true if all x NAs and narm=TRUE
403-
iw[0] = o+i-k+1;
404-
w[0] = x[iw[0]];
402+
const uint64_t ii = o+i-k+1;
403+
if (x[ii] >= w[0]) { // this never true if all x NAs and narm=TRUE
404+
iw[0] = ii;
405+
w[0] = x[ii];
405406
}
406407
}
407408
} else {

0 commit comments

Comments
 (0)