Skip to content

Commit

Permalink
equivalent .Call() version of the x + 1 routine
Browse files Browse the repository at this point in the history
  • Loading branch information
duncantl committed May 19, 2019
1 parent f7a9b74 commit 013d197
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions dotC/src/dotCall.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <Rdefines.h>

SEXP
R_add1_2(SEXP x)
{
int len = LENGTH(x) ; //Rf_length(x);
SEXP ans;
if(TYPEOF(x) != REALSXP) {
PROBLEM "wrong type"
ERROR;
}
ans = NEW_NUMERIC(len);
for(int i = 0; i < len; i++)
REAL(ans)[i] = REAL(x)[i] + 1;
return(ans);
}

0 comments on commit 013d197

Please sign in to comment.