diff --git a/src/r_utils.h b/src/r_utils.h index fc5926fd..d01a123b 100644 --- a/src/r_utils.h +++ b/src/r_utils.h @@ -9,6 +9,16 @@ #include #include +#ifdef R_VERSION +# if (R_VERSION >= R_Version(4, 4, 0)) +# define R_PRIdXLEN_T "td" +# else +# define R_PRIdXLEN_T "d" +# endif +#else +# define R_PRIdXLEN_T "d" +#endif + namespace vroom { inline std::string diff --git a/src/vroom_big_int.h b/src/vroom_big_int.h index eaa2bba0..0f352634 100644 --- a/src/vroom_big_int.h +++ b/src/vroom_big_int.h @@ -7,6 +7,7 @@ constexpr long long NA_INTEGER64 = 0x8000000000000000LL; #include "vroom.h" +#include "r_utils.h" namespace cpp11 { inline bool is_na(long long x) { return x == NA_INTEGER64; } @@ -56,9 +57,10 @@ class vroom_big_int : public vroom_vec { static Rboolean Inspect(SEXP x, int, int, int, void (*)(SEXP, int, int, int)) { Rprintf( - "vroom_big_int (len=%d, materialized=%s)\n", - Length(x), - R_altrep_data2(x) != R_NilValue ? "T" : "F"); + "vroom_big_int (len=%" R_PRIdXLEN_T ", materialized=%s)\n", + Length(x), + R_altrep_data2(x) != R_NilValue ? "T" : "F"); + return TRUE; }