Skip to content

Commit c975c14

Browse files
simplify for loop
1 parent 854d35e commit c975c14

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/bmerge.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,9 @@ SEXP bmerge(SEXP idt, SEXP xdt, SEXP icolsArg, SEXP xcolsArg, SEXP xoArg, SEXP r
163163
retFirst[j] = nomatch; // default to no match for NA goto below
164164
}
165165
// retLength[j] = 0; // TO DO: do this to save the branch below and later branches at R level to set .N to 0
166-
if (nomatch==0) {
167-
for (int j=0; j<anslen; j++)
168-
retLength[j] = 0;
169-
} else { // nomatch==NA
170-
for (int j=0; j<anslen; j++)
171-
retLength[j] = 1;
172-
}
166+
int retLengthVal = (int)(nomatch != 0);
167+
for (int j=0; j<anslen; j++)
168+
retLength[j] = retLengthVal;
173169

174170
// allLen1Arg
175171
allLen1Arg = PROTECT(allocVector(LGLSXP, 1));

0 commit comments

Comments
 (0)