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

Question about: 4.1.1 Integer representation

From: Frédéric Kayser <f.kayser@free.fr>
Date: Fri, 18 Oct 2013 10:01:25 +0200
Message-Id: <3D0CEF94-7A8C-4B38-8242-CDC582A67F0C@free.fr>
To: ietf-http-wg@w3.org
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 08:01:52 UTC

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