python implementation of a new integer encoding algorithm.

Ian Kelly ian.g.kelly at gmail.com
Thu Feb 19 13:16:10 EST 2015


On Thu, Feb 19, 2015 at 11:04 AM, Ian Kelly <ian.g.kelly at gmail.com> wrote:
> There's also an optimization that can be added here if we wish to
> inject a bit of cleverness. Notice that all values with more than one
> group start with 11, never 10. We can borrow a trick from IEEE
> floating point and make the leading 1 bit of the mantissa implicit for
> all values greater than 3 (we can't do it for 2 and 3 because then we
> couldn't distinguish them from 0 and 1). Applying this optimization
> removes one full group from the representation of all values greater
> than 3, which appears to make the stop-bit representation as short as
> or shorter than the "difficult" one for all the values that have been
> enumerated above.

I made a mistake. This trick only works if the second group is 10, so
it only applies to half the numbers. That makes 12 and 13 a group
longer than the difficult representation, but on the other hand 18-23
are still a group shorter.



More information about the Python-list mailing list