int_to_varint: Translate integer vector into varint bytes

View source: R/varint_handling.R

int_to_varintR Documentation

Translate integer vector into varint bytes

Description

The function takes a vector of integers and translates them into a varint byte vector. 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), so the lenght of the input and output vectors do not match as soon as one of the numbers is larger than 127.

Usage

int_to_varint(int_array)

Arguments

int_array

vector of positive integers

Value

If all inputs are smaller than 2e9, a character vector containing varint bytes

Examples

lordecks:::int_to_varint(c(3, 128, 12, 217))
# returns c("00000011", "10000000", "00000001", "00001100", "11011001", "00000001")

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