Variable-Length Bit-Level Encoding

Nordlöw via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Nov 12 11:13:13 PST 2016


I'm looking for libraries/snippets (either in D or similar 
languages) that perform variable-length encoding of unsigned 
integers onto a bit-stream. Requirement is that smaller inputs 
(integer values) should be encoded with equal or fewer bits.

This

0 => [0]
1 => [1,0]
2 => [1,1,0]

is easy but assumes a too extreme input value distribution.

Does anybody have a suggestion for an encoder that is more 
suitable for real-world values that are, for instance, normally 
distributed?


More information about the Digitalmars-d-learn mailing list