Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Paul Rubin Newsgroups: comp.lang.python Subject: Re: python implementation of a new integer encoding algorithm. Date: Tue, 17 Feb 2015 08:43:30 -0800 Organization: A noiseless patient Spider Lines: 13 Message-ID: <87a90cfpzh.fsf@jester.gateway.pace.com> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="c694756f1077760bb5296aae16c74092"; logging-data="29047"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/qBT00AC+4b8sGmeGjFIPQ" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:ZmjiDb1ipDgrHTFh7R7pnBQjAR8= sha1:95IAjm8uqfrz7H8Y4t3JR5F6eVU= Xref: csiph.com comp.lang.python:85746 janhein.vanderburg@gmail.com writes: > The next step is the development of the python code that minimizes > processor requirements without compromising the algorithm. This is a reasonable place to ask specific python questions. The algorithm description itself is pretty confusing though, and it seems to address a problem that doesn't particularly seem to need a solution. It's pretty typical for applications needing compact representations to encode smallish variable-length integers in the VInt format, basically using 7 bits from each byte for data, and the 8th bit as a terminator flag. So VInt encodes numbers 0-127 in one byte, 128 to 16383 in 2 bytes, etc. Bignum applications generally use a length cell and a data array.