r-lib / bit64

An R package with an S3 Class for Vectors of 64bit Integers
32 stars 8 forks source link

Provide `as.integer64()` method for raw vector #116

Closed hadley closed 1 month ago

hadley commented 1 month ago

It would have option to pick between big endian and little endian encoding, and would error if the length of the input wasn't a multiple of 8.

(I have a very slight need for this in httr2, since I'm adding support for AWS's streaming protocol which returns a few object types as int64s).

MichaelChirico commented 1 month ago

I think this is the same as #39... I don't like the idea of having an as.* coercion method that has different input/output length. Still I think the use case is common enough to support it somehow. More discussion there -- I would re-open that one if you think there's still more to do (e.g. I haven't confirmed whether the endianness aspect is covered by my simple wrappers).

hadley commented 1 month ago

Fair enough, but I do think that you need some function for this purpose.