Applying bitwise computations on very large numbers (above int max)

Hey, I'm trying to apply binary operators such as right shifting (bitwise) on large numbers such as:
208936898566160384
Now, this is my current code:

options(digits = 22)
#' A function which resolves an ID to a timestamp in ms
#' @export
#' @param id The ID you want to resolve
DISCORD_EPOCH <- 1420070400000

resolve.snowflake <- function(id) {
  print(bitwShiftR(as.numeric(id), 22) + DISCORD_EPOCH) # NA because of coercion
}

How would it be possible to avoid that coercion?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.