R/bits.R

"bits" <-
function(object,bit) {
  out <- (object %/% (2^bit)) %% 2
  if (!is.null(dim(object))) dim(out) <- dim(object)
  out
}

"bits<-" <-
function(object,bit,value) {
  mask <- 2^bit
  object <- object+(value - ((object %/% mask) %% 2))*mask
  object
}

Try the tripEstimation package in your browser

Any scripts or data that you put into this service are public.

tripEstimation documentation built on April 22, 2023, 1:11 a.m.