Decoding
To decode an Elias gamma-coded integer:
- Read and count 0s from the stream until you reach the first 1. Call this count of zeroes N.
- Considering the one that was reached to be the first digit of the integer, with a value of 2N, read the remaining N digits of the integer.
Read more about this topic: Elias Gamma Coding