Self-Delimiting Numeric Values
Definition/Motivation
- support unforeseen needs
- "compact" encoding for wide range of integer values
- similar to ASN.1 encoding of object ID arcs
- no hard upper limit on values
- Value comprises bytes 1..N
- MSb in byte N is 0; the rest are 1’s
- value is concatenation of 7 LSb’s in bytes (1..N)
- can handle ~16-30 bit values “well”
- also allows you to carry much larger values
Examples
- 0xABC (1010 1011 1100) is encoded as follows:
- 10010101 00111100
- 0x1234 (0001 0010 0011 0100) is encoded as:
- 10100100 00110100
- 0x7f (0111 1111) is encoded as:
- 01111111
- Note this is the best case scenario for 8-bit input.
- 0x8f (1000 1111) is encoded as:
- 10000001 00001111
- Note this is the worst case scenario for 8-bit input.
From Kevin Fall's presentation at IETF63.