I'm working on modernizing Rosetta Code's infrastructure. Starting with communications. Please accept this time-limited open invite to RC's Slack.. --Michael Mol (talk) 20:59, 30 May 2020 (UTC)

Talk:Variable-length quantity

From Rosetta Code

Concrete[edit]

How about making the task more concrete by, say, changing it to a task to show the bits of 12345678901234566789 as binary then as Vlq - mabe grouping into 8 bit octets for readability? Then a function to change back and display the result . --Paddy3118 16:00, 14 October 2010 (UTC)

Done! dingowolf 16:58, 14 October 2010 (UTC)

Vlq octet order[edit]

The wp article states:

VLQ octets are arranged most significant first in a stream.

Which doesn't make sense as the least significant octet has to be sent first so that its eighth bit can be sampled to see if there will be another octet or not. --Paddy3118 15:14, 15 October 2010 (UTC)

I think, in a mixed data stream for storage or transmission, the VLQ has to be like a big ending number , so that the least significant octet act as a terminal, if no other information telling the length of the VLQ. If the stream contain only VLQ, the least significant octet can sent first. dingowolf 16:27, 15 October 2010 (UTC)
What? I read the docs as saying that it is the LSO that has its low bit cleared, making perfect sense as a terminator. –Donal Fellows 13:48, 17 October 2010 (UTC)

I interpret an 8-to-14 bit integer being sent as the first and second bytes being, in order:

VLQ Octet #0
 7  6  5  4  3  2  1  0
26 25 24 23 22 21 20
1 Bn
VLQ Octet #1
 7  6  5  4  3  2  1  0
213 212 211 210 29 28 27
0 Bn

i.e. the first byte/octet through would have its high bit set and the last octet would not. --Paddy3118 17:17, 17 October 2010 (UTC)

I agree with Paddy. See also: http://en.wikipedia.org/wiki/File:Uintvar_coding.svg --Rdm 23:07, 17 October 2010 (UTC)