/ vctrs Public
Custom integer64 slicing support #813
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge.
This PR adds integer64 support for
vec_slice(), repairing the object whenever it is sliced with
NA_integer_, which is unsupported by the cran version of bit64.
By extension this allows us to use
vec_init()with these objects, freeing us to hard-code casting of
unspecified()objects to any
vec_init(to, vec_size(x))in #812
This adds two new R functions:
vec_slice_fallback_integer64()for use with shaped integer64 objects
vec_slice_dispatch_integer64()for use with 1D integer64 objects
When slicing with shaped objects, the C level
vec_slice_fallback()will switch to calling the R level
vec_slice_fallback_integer64()if the input is integer64.
When slicing 1D objects with
[, I've added a new C level
vec_slice_dispatch()that either calls out to
vec_slice_dispatch_integer64()or does our original behavior of calling to
The rationale for doing the
inherits(x, "integer64")check at the C level is for speed with
vec_chop(). We don't want to slow down
vec_chop()on things like factors by making it repeatedly call
inherits(x, "integer64")to decide which slicing path to take. We can determine whether we need
vec_slice_dispatch_integer64()once up front, and then construct the slice call using that function. It feels a little invasive because now
chop_fallback()has to "know" about integer64 objects, but the benefits seem worth it
This makes the assumption that if
inherits(x, "integer64")is true, then the user has bit64 installed. I can add an
vec_slice_dispatch_integer64()if you feel it is worth it.