BrowserUk has asked for the wisdom of the Perl Monks concerning the following question:
The input is a byte stream. The required output is a list or array of integers decoded from it.
The highest two bits in first byte of each integer value in the input stream decide how long the value is:
then the output is the numeric value of the other 7-bits in that byte.
01010101 == 85
The output is the numeric value of lowest 14-bits of the first and second bytes treated as a big-endian short.
10101010_10101010 == 10922
Then the output is the numeric value of the lowest 22-bits of the first three bytes of input (big-endian).
11001100_11001100_11001100 == 838860
Thoughts?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: [NOT] How would you decode this?
by Corion (Patriarch) on Dec 28, 2010 at 15:21 UTC | |
|
Re: How would you decode this? (3 steps)
by tye (Sage) on Dec 29, 2010 at 00:44 UTC | |
|
Re: [NOT] How would you decode this?
by jethro (Monsignor) on Dec 28, 2010 at 15:27 UTC | |
by BrowserUk (Patriarch) on Dec 28, 2010 at 15:48 UTC | |
by jethro (Monsignor) on Dec 28, 2010 at 16:10 UTC | |
by Corion (Patriarch) on Dec 28, 2010 at 16:11 UTC | |
by jethro (Monsignor) on Dec 28, 2010 at 16:13 UTC | |
| |
by BrowserUk (Patriarch) on Dec 28, 2010 at 16:11 UTC | |
|
Re: [NOT] How would you decode this?
by talexb (Chancellor) on Dec 28, 2010 at 15:46 UTC | |
|
Re: [NOT] How would you decode this?
by juster (Friar) on Dec 28, 2010 at 17:22 UTC | |
|
Re: [NOT] How would you decode this?
by roboticus (Chancellor) on Dec 29, 2010 at 00:47 UTC | |
|
Re: [NOT] How would you decode this?
by johngg (Canon) on Dec 28, 2010 at 23:51 UTC | |
|
Re: [BUK] How would you decode this?
by LanX (Saint) on Dec 28, 2010 at 16:11 UTC | |
by planetscape (Chancellor) on Dec 29, 2010 at 12:12 UTC |