Skip to content

Commit

Permalink
Mor int64 support.
Browse files Browse the repository at this point in the history
  • Loading branch information
NicChr committed Sep 22, 2024
1 parent f780b80 commit 9e52e72
Show file tree
Hide file tree
Showing 5 changed files with 227 additions and 160 deletions.
10 changes: 8 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@

* New function `vector_length` as a hybrid between `length` and `nrow`.

* Limited support added for 'integer64' objects. This applies to the
`NA` related functions as well as the GCD and LCM functions.
* `gcd` and `scm` now make use of 64-bit integers internally and can accept
'integer64' objects. `scm` used to return `NA` once the 32-bit integer limit
of 2^31 - 1 was reached if the input was an integer vector.
This has now been increased to the 64-bit integer limit,
which is approximately 9.223372e+18.

* 'integer64' objects are now lightly supported. They are not
supported in any sequence functions or in the 'set_math' functions.

* New functions `new_df` and `named_dots`.

Expand Down
25 changes: 0 additions & 25 deletions src/altrep_utils.cpp → src/altrep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,28 +75,3 @@ SEXP altrep_materialise(SEXP x) {
// if (ALTREP(x)) DATAPTR(x);
// return x;
}

// SEXP altrep_materialise(SEXP x) {
// if (!ALTREP(x)) return x;
// SEXP out;
// R_xlen_t n = Rf_xlength(x);
// switch (TYPEOF(x)) {
// case INTSXP: {
// out = Rf_protect(Rf_allocVector(INTSXP, n));
// INTEGER_GET_REGION(x, 0, n, INTEGER(out));
// break;
// }
// case REALSXP: {
// out = Rf_protect(Rf_allocVector(REALSXP, n));
// REAL_GET_REGION(x, 0, n, REAL(out));
// break;
// }
// default: {
// // This is a pretty hacky way of doing it..
// cpp11::function base_subset = cpp11::package("base")["["];
// out = Rf_protect(base_subset(x));
// }
// }
// Rf_unprotect(1);
// return out;
// }
4 changes: 2 additions & 2 deletions src/cpp11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
#include "cpp11/declarations.hpp"
#include <R_ext/Visibility.h>

// altrep_utils.cpp
// altrep.cpp
bool is_compact_seq(SEXP x);
extern "C" SEXP _cheapr_is_compact_seq(SEXP x) {
BEGIN_CPP11
return cpp11::as_sexp(is_compact_seq(cpp11::as_cpp<cpp11::decay_t<SEXP>>(x)));
END_CPP11
}
// altrep_utils.cpp
// altrep.cpp
SEXP compact_seq_data(SEXP x);
extern "C" SEXP _cheapr_compact_seq_data(SEXP x) {
BEGIN_CPP11
Expand Down
Loading

0 comments on commit 9e52e72

Please sign in to comment.