Skip to content

Commit

Permalink
formatting-only subtracted from #3701
Browse files Browse the repository at this point in the history
  • Loading branch information
mattdowle committed Jul 19, 2019
1 parent 1ef7456 commit ebe5787
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions src/uniqlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,10 @@ SEXP rleid(SEXP l, SEXP cols) {
break;
case REALSXP : {
long long *ll = (long long *)REAL(jcol);
same = ll[i]==ll[i-1]; }
same = ll[i]==ll[i-1];
// 8 bytes of bits are identical. For real (no rounding currently) and integer64
// long long == 8 bytes checked in init.c
break;
} break;
default :
error("Type '%s' not supported", type2char(TYPEOF(jcol))); // # nocov
}
Expand All @@ -210,28 +210,25 @@ SEXP rleid(SEXP l, SEXP cols) {
SEXP jcol = VECTOR_ELT(l, icols[0]-1);
switch (TYPEOF(jcol)) {
case INTSXP : case LGLSXP : {
int *ijcol = INTEGER(jcol);
for (R_xlen_t i=1; i<nrow; i++) {
bool same = ijcol[i]==ijcol[i-1];
ians[i] = (grp+=!same);
}
int *ijcol = INTEGER(jcol);
for (R_xlen_t i=1; i<nrow; i++) {
bool same = ijcol[i]==ijcol[i-1];
ians[i] = (grp+=!same);
}
break;
} break;
case STRSXP : {
for (R_xlen_t i=1; i<nrow; i++) {
bool same = STRING_ELT(jcol,i)==STRING_ELT(jcol,i-1);
ians[i] = (grp+=!same);
}
for (R_xlen_t i=1; i<nrow; i++) {
bool same = STRING_ELT(jcol,i)==STRING_ELT(jcol,i-1);
ians[i] = (grp+=!same);
}
break;
} break;
case REALSXP : {
long long *lljcol = (long long *)REAL(jcol);
for (R_xlen_t i=1; i<nrow; i++) {
bool same = lljcol[i]==lljcol[i-1];
ians[i] = (grp+=!same);
}
long long *lljcol = (long long *)REAL(jcol);
for (R_xlen_t i=1; i<nrow; i++) {
bool same = lljcol[i]==lljcol[i-1];
ians[i] = (grp+=!same);
}
break;
} break;
default :
error("Type '%s' not supported", type2char(TYPEOF(jcol)));
}
Expand Down

0 comments on commit ebe5787

Please sign in to comment.