The long is a method of encoding integers. It's similar to varint. But it optimised for negative numbers too.
On the paly.golang.org
// i - inverse flag (bit)
// n - next byte flag (bit)
// d - data (bit)
// [] - byte
// there is an example number (t):
[dddd dddd][dddd dddd][dddd dddd][dddd dddd]
// if t < ^t the t will be inverted and the inverse bit will be set
// decoded:
// .head
// [dddd ddin]
// .body
// [dddd dddn]
// [dddd dddn]
// etc
// length of result from 1 to 10 inclusive
go get github.com/logrusorgru/long
cd $GOPATH/github.com/logrusorgru/long
go test
Copyright © 2015 Konstantin Ivanov [email protected]
This work is free. You can redistribute it and/or modify it under the
terms of the Do What The Fuck You Want To Public License, Version 2,
as published by Sam Hocevar. See the LICENSE file for more details.