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

Incorrect header length #17

Open
luna-duclos opened this issue Oct 11, 2016 · 1 comment
Open

Incorrect header length #17

luna-duclos opened this issue Oct 11, 2016 · 1 comment

Comments

@luna-duclos
Copy link

Headers are encoded with Varint encoding, as per the spec for varint: https://developers.google.com/protocol-buffers/docs/encoding

Varint encoding uses the 8th bit of each byte as a more flag.
As such, only 7 bits per byte actually contain data.

This means that a 64 bit number now needs 80 bits to actually be encoded if the number is large enough.

@StabbyCutyou
Copy link
Owner

Thanks for finding this. Although I could account for this by adjusting the calculation for the header size, I'm wondering if you know of a better approach for calculating this size not using Varint encoding?

I have gone through a few different approaches here and Varint seemed the most reliable, but I know there are some other approaches, wondering if you have any opinions on a better one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants