Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upVarint enum tags and lengths behind a feature #271
Conversation
|
I think it should be possible to use the |
|
Doing it per-config rather than per-project seems better. What breaking change would be required? |
|
I was afraid we'd have to add an enum variant or some such, but looking at how |
Tolsi
commented
Oct 14, 2019
|
Any updates? |
|
@Tolsi sorry, I haven't put more time into this since, if anyone wants to pick it up from where I left it feel free, I don't think I'll have time to work on this anytime soon. |
|
Closing in favor of #306 |
maciejhirsz commentedJun 8, 2019
•
edited
Resolves #157, resolves #75.
Varint support needs to be enabled with the
varintfeature, it only affects enum tags and sequence lengths, all fixed size ints travel over the wire without alterations.The particular encoding is pretty straight forward: while
nis greater then127keep taking lowest 7 bits and serialize them asu8with significant bit set to1, final byte is always encoded without significant bit. Varint ignores the endianess setting, partly because I think it's unnecessary in this case, partly because I didn't want to wrap my head around it and potentially introduce weird cases where the first byte for a value>= 128lacks significant bit set. I didn't bother to check which direction ProtoBuf or Go varint does things, if it's different I can change it.#167 can still technically be done as I don't verify that varints are encoded to their smallest possible representation.