Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

logrusorgru/long

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

long

GoDoc WTFPL License Build Status Coverage Status GoReportCard Gitter

The long is a method of encoding integers. It's similar to varint. But it optimised for negative numbers too.

Representation

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

Get

go get github.com/logrusorgru/long
cd $GOPATH/github.com/logrusorgru/long
go test

Licensing

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.

Releases

No releases published

Packages

No packages published

Languages