What Integer encoding scheme is used to achieve the following, and how can we do this in .Net:
127 = 7F
128 = 8001
255 = FF01
256 = 8002
500 = F403
See Question&Answers more detail:osWhat Integer encoding scheme is used to achieve the following, and how can we do this in .Net:
127 = 7F
128 = 8001
255 = FF01
256 = 8002
500 = F403
See Question&Answers more detail:osNot so sure it has an official name, it is a 7-bit encoding. It is a variable length encoding, the high bit of a byte is set if another byte follows. Byte order is little-endian.
The .NET Framework uses it, Write7BitEncodedInt() method. Used by the BinaryWriter.WriteString() method, it saves space since most practical strings have less than 128 characters.
So F403 => 03F4 => |0000011|1110100| => |00000001|11110100| => 0x1F4 == 500