W3C home > Mailing lists > Public > ietf-http-wg@w3.org > October to December 2013

Re: Question about: 4.1.1 Integer representation

From: Roberto Peon <grmocg@gmail.com>
Date: Fri, 18 Oct 2013 09:09:54 -0700
Message-ID: <CAP+FsNcAXY-zOnn8ENp95nYHU8Yr24oqSmq=gO6tKEqj522S=Q@mail.gmail.com>
To: Frédéric Kayser <f.kayser@free.fr>
Cc: HTTP Working Group <ietf-http-wg@w3.org>
Yes, the binary operations are equivalent to the arithmetic operations
currently specified.
I originally had the binary operators in there, but guessed that those
familiar with binary operators would do the mapping as you have done, but
that for those for whom binary operators was foreign, if would still be
understandable.

A fair bit of efficiency is gained by allowing the n-bit prefix to encode
values since most values for within that first byte.
The rest of the int is in a well known and well supported format.
-=R
On Oct 18, 2013 1:03 AM, "Frédéric Kayser" <f.kayser@free.fr> wrote:

> Hello,
> I have a pretty dumb question regarding integer representation isn't it
> easier to grasp expressed as binary masking and right shifts?
> This should be the same
> I % 128  becomes  I & 127
> I / 128 becomes  I >> 7
>
> And wouldn't it be way easier and faster to record/reconstruct such
> integers by moving all the flags (most significant bits) of each byte in
> front of the code?
>
> I < 128
> 0xxxxxxx
> I < 16.384
> 10xxxxxx xxxxxxxx  (compared to 1yyyyyyy 0yyyyyyy groups of 7 least
> significant bits first)
> I < 2.097.152
> 110xxxxx xxxxxxxx xxxxxxxx  (compared to 1yyyyyyy 1yyyyyyy 0yyyyyyy groups
> of 7 least significant bits first)
> I < 268.435.456
> 1110xxxx xxxxxxxx xxxxxxxx xxxxxxxx  (compared
> to 1yyyyyyy 1yyyyyyy 1yyyyyyy 0yyyyyyy groups of 7 least significant bits
> first)
> …
>
> Where xxx…xxx is simply the binary representation of I
>
> The first part looks like unary coding and the overall form of this
> encoding is a 7, 7, ∞ start-step-code or a base 128 Elias γ′ code, do you
> really want to keep the universal nature of such a code or cap it?
>
> Regards
> --
> Frédéric Kayser
>
Received on Friday, 18 October 2013 16:10:25 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 1 March 2016 11:11:18 UTC