Skip to content

Commit

Permalink
Merge pull request #435 from SebKrantz/development
Browse files Browse the repository at this point in the history
Should fix #434 (unable to reproduce it on M1 mac).
  • Loading branch information
SebKrantz committed Jul 10, 2023
2 parents d33a759 + febd37b commit 7a3daf8
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions src/programming.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,28 +94,28 @@ if(length(val) == n && n > 1) {
const int *px = INTEGER(x);
const int *pv = INTEGER(val);
WHICHVLOOPLX
break;
break;
}
case REALSXP:
{
const double *px = REAL(x);
const double *pv = REAL(val);
WHICHVLOOPLX
break;
break;
}
case STRSXP:
{
const SEXP *px = STRING_PTR(x);
const SEXP *pv = STRING_PTR(val);
WHICHVLOOPLX
break;
break;
}
case RAWSXP :
{
const Rbyte *px = RAW(x);
const Rbyte *pv = RAW(val);
WHICHVLOOPLX
break;
break;
}
default: error("Unsupported type '%s' passed to whichv()", type2char(TYPEOF(x)));
}
Expand All @@ -132,7 +132,7 @@ if(length(val) == n && n > 1) {
v = fchmatch(getAttrib(x, R_LevelsSymbol), val, 0);
} else v = asInteger(val);
WHICHVLOOP
break;
break;
}
case REALSXP:
{
Expand All @@ -152,16 +152,17 @@ if(length(val) == n && n > 1) {
case STRSXP:
{
const SEXP *px = STRING_PTR(x);
const SEXP v = asChar(val);
const SEXP v = PROTECT(asChar(val));
WHICHVLOOP
break;
UNPROTECT(1);
break;
}
case RAWSXP :
{
const Rbyte *px = RAW(x);
const Rbyte v = RAW(val)[0];
WHICHVLOOP
break;
break;
}
default: error("Unsupported type '%s' passed to whichv()", type2char(TYPEOF(x)));
}
Expand Down Expand Up @@ -198,29 +199,29 @@ case LGLSXP:
v = fchmatch(getAttrib(x, R_LevelsSymbol), val, 0);
} else v = asInteger(val);
ALLANYVLOOP
break;
break;
}
case REALSXP:
{
const double *px = REAL(x);
const double v = asReal(val);
if(ISNAN(v)) error("please use allNA()");
ALLANYVLOOP
break;
break;
}
case STRSXP:
{
const SEXP *px = STRING_PTR(x);
const SEXP v = asChar(val);
ALLANYVLOOP
break;
break;
}
case RAWSXP :
{
const Rbyte *px = RAW(x);
const Rbyte v = RAW(val)[0];
ALLANYVLOOP
break;
break;
}
default: error("Unsupported type '%s' passed to allv() / anyv()", type2char(TYPEOF(x)));
}
Expand Down Expand Up @@ -383,8 +384,9 @@ SEXP setcopyv(SEXP x, SEXP val, SEXP rep, SEXP Rinvert, SEXP Rset, SEXP Rind1) {
if(lv == 1 && ind1 == 0) {
const SEXP v = PROTECT(asChar(val));
if(lr == 1) {
const SEXP r = asChar(rep);
const SEXP r = PROTECT(asChar(rep));
setcopyvLOOP(r)
UNPROTECT(1);
} else {
const SEXP *restrict pr = STRING_PTR(rep);
setcopyvLOOP(pr[i])
Expand All @@ -393,8 +395,9 @@ SEXP setcopyv(SEXP x, SEXP val, SEXP rep, SEXP Rinvert, SEXP Rset, SEXP Rind1) {
} else {
const int *restrict pv = INTEGER(val); // ALTREP(val) ? (const int *)ALTVEC_DATAPTR(val) :
if(lr == 1) {
const SEXP r = asChar(rep);
const SEXP r = PROTECT(asChar(rep));
setcopyvLOOPLVEC1
UNPROTECT(1);
} else {
const SEXP *restrict pr = STRING_PTR(rep);
setcopyvLOOPLVEC
Expand Down

0 comments on commit 7a3daf8

Please sign in to comment.