Skip to content

Commit 5a15c12

Browse files
committed
Use Rf_xlength instead of Rf_length to support long vectors
There is one remaining use of Rf_length where the dimensions are checked. Long vectors support is not needed there.
1 parent 915b200 commit 5a15c12

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

inst/include/RcppEigenWrap.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ namespace Rcpp{
159159
template <typename T, int RTYPE>
160160
class Eigen_Matrix_Exporter {
161161
public:
162-
Eigen_Matrix_Exporter(SEXP x) : vec(x), d_ncol(1), d_nrow(Rf_length(x)) {
162+
Eigen_Matrix_Exporter(SEXP x) : vec(x), d_ncol(1), d_nrow(Rf_xlength(x)) {
163163
if (TYPEOF(x) != RTYPE)
164164
throw std::invalid_argument("Wrong R type for mapped vector");
165165
if (::Rf_isMatrix(x)) {
@@ -254,7 +254,7 @@ namespace Rcpp{
254254
int d_ncol, d_nrow ;
255255

256256
public:
257-
Exporter(SEXP x) : vec(x), d_ncol(1), d_nrow(Rf_length(x)) {
257+
Exporter(SEXP x) : vec(x), d_ncol(1), d_nrow(Rf_xlength(x)) {
258258
if (TYPEOF(x) != RTYPE)
259259
throw std::invalid_argument("Wrong R type for mapped matrix");
260260
if (::Rf_isMatrix(x)) {
@@ -274,7 +274,7 @@ namespace Rcpp{
274274
int d_ncol, d_nrow ;
275275

276276
public:
277-
Exporter(SEXP x) : vec(x), d_ncol(1), d_nrow(Rf_length(x)) {
277+
Exporter(SEXP x) : vec(x), d_ncol(1), d_nrow(Rf_xlength(x)) {
278278
if (TYPEOF(x) != RTYPE)
279279
throw std::invalid_argument("Wrong R type for mapped 2D array");
280280
if (::Rf_isMatrix(x)) {

0 commit comments

Comments
 (0)