Comments (3)
Distinguishing at runtime based on the values would be quite expensive.
Perhaps we can emit data compatible with the bit64
package. i.e. something that looks like a numeric vector but uses the 64 bits of the double
to store the 64 bits of a 64 bits integer.
from rcpp.
Just want to put here related rcpp-devel discussion (I think could be someone looking how to use bit64
with Rcpp
). Mb worth to put method described by @kevinushey to Rcpp FAQ.
#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
NumericVector timesTwo(NumericVector input) {
R_xlen_t n = input.size();
NumericVector output = no_init(n);
long long* pInput = (long long*) dataptr(input);
long long* pOutput = (long long*) dataptr(output);
for (R_xlen_t i = 0; i < n; i++)
*pOutput++ = *pInput++ * 2;
output.attr("class") = "integer64";
return output;
}
/*** R
library(bit64)
object <- as.integer64(1:16)
timesTwo(object)
*/
from rcpp.
This issue is stale (365 days without activity) and will be closed in 31 days unless new activity is seen. Please feel free to re-open it is still a concern, possibly with additional data.
from rcpp.
Related Issues (20)
- New R-devel nags on 'R_forceSymbols' and `compileAttributes()` HOT 1
- sourceCpp compile error stderr cannot be caught/suppressed HOT 10
- rcpp name export error when installing packages that depend on rcpp HOT 5
- Can't use std::shared_ptr in Rcpp R 4.3 beta, Rcpp 1.0.10, using (specifically) C++23 HOT 17
- Document Rcpp functions with default arguments that appear in their header files HOT 3
- Memory management questions HOT 12
- Unexpected error-handling since 1.0.10 HOT 9
- Avoid readability-avoid-const-params-in-decls? HOT 5
- Add support for check.names HOT 5
- Compiler warning on windows-arm64 (libc++) HOT 3
- Figure 3 incorrect caption in Rcpp-introduction vignette HOT 2
- Upstreaming `std::tuple<>` support HOT 10
- sourceCpp crashes R when called about 1000 times on same code HOT 10
- Integer overflow in `MatrixRow` offset calculations for large matrices HOT 8
- Switch from S4SXP to OBJSXP HOT 2
- pass by const refererence HOT 1
- A fresh -Wformat-security issue under r-devel HOT 9
- 'CRAN package Rcpp' notice HOT 5
- Installation/Compiling Error for Package with Rcpp dependency - Ubuntu (rvmf.cpp?) HOT 5
- Exporting classes using `Rcpp::interfaces(cpp)` that are shared among multiple cpp files through header file HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rcpp.