Varints must be as short as possible to be canonical
This commit is contained in:
parent
fe8c766d1e
commit
8aaec11635
|
@ -26,6 +26,8 @@ Annotations MUST NOT be present.
|
|||
Placeholders MUST NOT be used.
|
||||
Where possible, fixed-length ("format A") MUST be used in preference
|
||||
to variable-length ("format B") formats.
|
||||
Lengths in variable-length encodings (base 128 varints) MUST be as
|
||||
short as possible.
|
||||
|
||||
**Signed integers.**
|
||||
When a `SignedInteger` *n* is greater than or equal to -3 and less
|
||||
|
|
|
@ -516,6 +516,10 @@ The following table illustrates varint-encoding.
|
|||
| 300 | `0000010 0101100` | 172 2 |
|
||||
| 1000000000 | `0000011 1011100 1101011 0010100 0000000` | 128 148 235 220 3 |
|
||||
|
||||
It is an error for a varint-encoded `m` in a `Repr` to be anything
|
||||
other than the unique shortest encoding for that `m`. That is, a
|
||||
varint-encoding of `m` *MUST NOT* end in `0` unless `m`=0.
|
||||
|
||||
#### Streaming data of unknown length (format C).
|
||||
|
||||
A `Repr` where the length of the `Value` to be encoded is variable and
|
||||
|
|
Loading…
Reference in New Issue