Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.184 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.64; '*S*': 0.00; 'removes': 0.07; 'subject:python': 0.16; 'applies': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'thu,': 0.19; 'feb': 0.22; 'appears': 0.22; 'second': 0.26; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'implicit': 0.31; 'subject:skip:i 10': 0.31; "can't": 0.35; 'but': 0.35; 'received:google.com': 0.35; '(we': 0.36; 'shorter': 0.36; 'half': 0.37; 'subject:new': 0.38; 'to:addr:python-list': 0.38; 'short': 0.38; "couldn't": 0.39; 'to:addr:python.org': 0.39; 'ian': 0.60; 'full': 0.61; 'more': 0.64; 'here': 0.66; 'wish': 0.70; 'applying': 0.72; 'hand': 0.80; '2015': 0.84; 'borrow': 0.84; 'distinguish': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=vvrfyVKzPUFrD4ZzWCXA7aTIdLeXqgirxRrJNKYXhFc=; b=d1zhsU9HkrLfkdd++gmVU24mrlko4tmutE+Ru2CIka3s15KYsYAdhNWhmaCwJwJCMw V5MozJxsobZi36Ltf7XrZbali0kqMn20GlXZFkI9Q+BDFUCTZuyOyNP58gR/BC8w/ED7 JZpYdyTvwcwH4F1tBtv/UFsAUewQLPXAQS+2hfhgSAu2u4QDhlAhmkIrsQO3n+nTpy+t sW6zn4u3V0X4cSbgZ+SKb64IJH633AUuKRM/JNbGcJryfOR/ewD8mydo099R30NVGQV2 GZYe5QBpNftmPmFA0JXVDsl22Tnf6pC8pDcyv3izGHnVPzBchFgMyCsrQnV9v2/LG7/K HfJw== X-Received: by 10.68.97.226 with SMTP id ed2mr2553520pbb.17.1424369810414; Thu, 19 Feb 2015 10:16:50 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: <515047c1-a20d-430e-a029-1c2d77db2f1a@googlegroups.com> <2a717ffb-d61d-4407-9082-1c17cd7ee573@googlegroups.com> <993f64c3-fc85-48a7-9d02-a4f12ecb33c6@googlegroups.com> From: Ian Kelly Date: Thu, 19 Feb 2015 11:16:10 -0700 Subject: Re: python implementation of a new integer encoding algorithm. To: Python Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1424369820 news.xs4all.nl 2840 [2001:888:2000:d::a6]:40567 X-Complaints-To: abuse@xs4all.nl Path: csiph.com!usenet.pasdenom.info!bete-des-vosges.org!feed.ac-versailles.fr!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Xref: csiph.com comp.lang.python:85917 On Thu, Feb 19, 2015 at 11:04 AM, Ian Kelly 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.