module

Mint::VLQ

Support for encoding the variable length quantity format.

This implementation is heavily based on https://github.com/mozilla/source-map Copyright 2009-2011, Mozilla Foundation and contributors, BSD

Constants

BASE64_DIGITS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".chars
VLQ_BASE = 1 << VLQ_BASE_SHIFT

binary: 100000

VLQ_BASE_MASK = VLQ_BASE - 1

binary: 011111

VLQ_BASE_SHIFT = 5

A single base 64 digit can contain 6 bits of data. For the base 64 variable length quantities we use in the source map spec, the first bit is the sign, the next four bits are the actual value, and the 6th bit is the continuation bit. The continuation bit tells us whether there are more digits in this value following this digit.

Continuation | Sign | | V V 101011

VLQ_CONTINUATION_BIT = VLQ_BASE

binary: 100000

Class methods

encode(int)

Returns the base 64 VLQ encoded value.

Source