antp / vlq

An implementation of Variable Length Quantity

Home Page:https://componentx.co.uk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Vlq

An implementation of Variable Length Quantity

From wikipedia:

A variable-length quantity (VLQ) is a universal code that uses an arbitrary number of binary octets (eight-bit bytes) to represent an arbitrarily large integer. A VLQ is essentially a base-128 representation of an unsigned integer with the addition of the eighth bit to mark continuation of bytes.

Blog article about the code

Installation

def deps do
  [
    {:Vlq, github: "antp/Vlq"}
  ]
end

Not on Hex?

Nope, the code is not complicated. Do you really need to pull this library in?

Why not just take it and put it in your project and have one less dependency!

Usage

iex> Vlq.encode(128)
# <<129, 0>>

iex> Vlq.decode(<<129, 0>>)
# 128

About

An implementation of Variable Length Quantity

https://componentx.co.uk

License:MIT License


Languages

Language:Elixir 100.0%