Varint
A library to compress integers using LEB128.
Installation
- Add
varint
to your list of dependencies inmix.exs
:
```elixir
def deps do
[{:varint, "~> 1.0.0"}]
end
```
- Ensure
varint
is started before your application:
```elixir
def application do
[applications: [:varint]]
end
```
Usage
LEB128
iex> Varint.LEB128.encode(300)
<<172, 2>>
iex> Varint.LEB128.decode(<<172, 2>>)
{300, <<>>}
Zigzag
iex> Varint.Zigzag.encode(-2)
3
iex> Varint.Zigzag.decode(3)
-2