Avoid having multiple ways to encode Delta Base Index of zero #2005
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As discussed in #2002, there are two ways to encode Delta Base Index of zero at the wire level; i.e. (sign-bit, delta-base-index)=(0, 0) and (1, 0).
To avoid having multiple ways to represent one value, currently, we prohibit the latter form from being used. A receiver is required to raise an error when it sees the latter.
This is not only an unnecessary complexity but also contradicts from the approach we use for Post-Base Indexes. In case of Post-Base Indexes, we introduce an offset of one so that the Post-Base
Index of zero and a non-Post-Base Index of zero do not overlap.
The commit adopts the approach to Delta Base Index; giving us consistency in the design and also removing an error check at the cost of requiring one subtraction.