Fast packed integers

Remco Bloemen

2010-08-04, last updated 2014-03-04

Unsigned integers

The encoding I implemented is the same as the one used in EBML. It works as follows

bits bytes pattern
7 1 1xxx xxxx
14 2 01xx xxxx xxxx xxxx
21 3 001x xxxx xxxx xxxx xxxx xxxx
28 4 0001 xxxx xxxx xxxx xxxx xxxx xxxx xxxx
35 5 0000 1xxx xxxx xxxx xxxx … xxxx xxxx xxxx
42 6 0000 01xx xxxx xxxx xxxx … xxxx xxxx xxxx
49 7 0000 001x xxxx xxxx xxxx … xxxx xxxx xxxx
56 8 0000 0001 xxxx xxxx xxxx … xxxx xxxx xxxx
64 9 0000 0000 xxxx xxxx xxxx … xxxx xxxx xxxx

Using a bit of

Signed integers