varint_bytes_to_binary: Translate varint bytes into binary integer

View source: R/varint_handling.R

varint_bytes_to_binaryR Documentation

Translate varint bytes into binary integer

Description

The function takes a vector of varint bytes and parses them into an array of integers (in binary format). For varints, the most significant bit indicates whether the next byte belongs to the same integer (1) or if it is the last byte (0).

Usage

varint_bytes_to_binary(bytearray)

Arguments

bytearray

character vector with each entry representing one byte ("01110011")

Value

If the input is a valid array of varint bytes, the function returns the corresponding integers in binary

Examples

lordecks:::varint_bytes_to_binary("01111111")
# returns "1111111"                        # = 127

lordecks:::varint_bytes_to_binary(c("01111111", "10000000", "00000001", "11011001", "00000001"))
# returns c(1111111, 00000010000000, 00000011011001)       # = c(127, 128, 217)

pholzmgit/lordecks documentation built on May 23, 2022, 11:03 a.m.