Skip to content

Commit

Permalink
more performant outHook
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Oct 27, 2023
1 parent c03d6ca commit 36ba21a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,9 @@ static SEXP nano_inHook(SEXP x, SEXP fun) {

static SEXP nano_outHook(SEXP x, SEXP fun) {

SEXP index;
index = Rf_coerceVector(x, INTSXP);
int idx = INTEGER(index)[0] - 1;
const int i = atoi(CHAR(STRING_ELT(x, 0))) - 1;

return VECTOR_ELT(fun, idx);
return VECTOR_ELT(fun, i);

}

Expand Down

0 comments on commit 36ba21a

Please sign in to comment.