[next][up][top][index]
search for:

transmitting a positive integer

The integer 0 is transmitted as a single zero byte. A positive integer of 28 bits or less is sent 7 bits at a time, with the high-order nonzero seven bits sent first. The highest bit of each byte except the last one is set to 1.

     
          00000000    or
          0xxxxxxx    or
          1xxxxxxx 0xxxxxxx    or
          1xxxxxxx 1xxxxxxx 0xxxxxxx    or
          1xxxxxxx 1xxxxxxx 1xxxxxxx 0xxxxxxx

A positive integer of more than 28 bits is sent as follows. First come four bytes, with seven bits of the number in each one, with the high bit of each byte set to 1. Then comes the number of succeeding bytes, transmitted as described above for a positive integer of 28 bits or less. Finally come the succeeding bytes, each containing 8 bits of the intger. Format:

     
          1xxxxxxx 1xxxxxxx 1xxxxxxx 1xxxxxxx  (first 28 bits)
          1xxxxxxx 0xxxxxxx                    (number of succeeding bytes)
          xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx  (succeeding bytes)
          xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx  (succeeding bytes)
          ...
          xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx  (succeeding bytes)
          xxxxxxxx xxxxxxxx                    (succeeding bytes)
It may happen that the first byte in the sequence above has the form 10000000.
[next][up][top][index]
search for: