crystal-uvarint
is an
unsigned varint
implementation in Crystal. The implementation is based on
varint.go.
Add this to your application's shard.yml
:
dependencies:
uvarint:
github: freitagbr/crystal-uvarint
require "uvarint"
e = UVarint.encode 300_u64
#=> e == [172_u8, 2_u8]
d = UVarint.decode e
#=> d == 300_u64
Use UVarint.encode
to encode a UInt64
to a varint, which is an
Array(UInt8)
(basically, an array of bytes).
Use UVarint.decode
to decode a varint to a UInt64
.
Create an issue or submit a PR. Be sure to add tests if need be.
- Fork it ( https://github.com/freitagbr/crystal-uvarint/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request