Talk:Variable-length quantity

From Rosetta Code
Latest comment: 13 years ago by Rdm in topic Vlq octet order


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)Reply[reply]

Done! dingowolf 16:58, 14 October 2010 (UTC)Reply[reply]

Vlq octet order

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)Reply[reply]

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)Reply[reply]
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)Reply[reply]

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)Reply[reply]

I agree with Paddy. See also: --Rdm 23:07, 17 October 2010 (UTC)Reply[reply]