The integer 0 is transmitted as a single zero byte. Otherwise, the sign of the integer is put into bit 6 of the first byte, and the bits of the absolute value of the integer are packed as follows: 6 bits into the first byte, 7 bits into 1, 2, or 3 more bytes, and 8 bits into each of the succeeding bytes. If 8 bit bytes are needed, then the number of them is sent as a positive integer after the first four bytes are sent. See also transmitting a positive integer. In the following illustration, S denotes the sign bit, and x's denote the bits of the integer.
00000000 or 0Sxxxxxx or 1Sxxxxxx 0xxxxxxx or 1Sxxxxxx 1xxxxxxx 0xxxxxxx or 1Sxxxxxx 1xxxxxxx 1xxxxxxx 0xxxxxxx or 1Sxxxxxx 1xxxxxxx 1xxxxxxx 1xxxxxxx (first 27 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)
i1 : binary = s -> concatenate between (" ", |
i2 : << binary ascii gg 63 << endl; |
i3 : << binary ascii gg 64 << endl; |
i4 : << binary ascii gg 127 << endl; |
i5 : << binary ascii gg 128 << endl; |
i6 : << binary ascii gg 2^10 << endl; |
i7 : << binary ascii gg 2^20 << endl; |
i8 : << binary ascii gg (-2^20) << endl; |
i9 : << binary ascii gg 2^30 << endl; |
i10 : << binary ascii gg 2^40 << endl; |
i11 : << binary ascii gg 2^50 << endl; |