Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parenthesize 2 * MaxEntries to prevent naive errors #1856

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions draft-ietf-quic-qpack.md
Expand Up @@ -718,24 +718,24 @@ safe to process the rest of the block. If Largest Reference is greater than
zero, the encoder transforms it as follows before encoding:

~~~
LargestReference = LargestReference mod (2*MaxEntries) + 1
LargestReference = (LargestReference mod (2 * MaxEntries)) + 1
~~~

The decoder reconstructs the Largest Reference using the following algorithm:

~~~
if LargestReference > 0:
LargestReference -= 1
CurrentWrapped = TotalNumberOfInserts mod (2*MaxEntries)
CurrentWrapped = TotalNumberOfInserts mod (2 * MaxEntries)

if CurrentWrapped >= LargestReference + MaxEntries:
# Largest Reference wrapped around 1 extra time
LargestReference += 2*MaxEntries
LargestReference += 2 * MaxEntries
else if CurrentWrapped + MaxEntries < LargestReference
# Decoder wrapped around 1 extra time
CurrentWrapped += 2*MaxEntries
CurrentWrapped += 2 * MaxEntries

LargestReference += (TotalNumberOfInserts - CurrentWrapped)
LargestReference += TotalNumberOfInserts - CurrentWrapped
~~~

TotalNumberOfInserts is the total number of inserts into the decoder's
Expand Down