Skip to content

New varint with unique values #269

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

Closed
wants to merge 1 commit into from
Closed

Conversation

ivan386
Copy link

@ivan386 ivan386 commented Dec 18, 2016

In the old code, they have the same value (0)
In the new code, they have:

varint [0] = 0
varint [128 0] = 128
varint [128 128 0] = 16512

In the old code, they have the same value (0)
In the new code, they have:
varint [0] = 0
varint [128 0] = 128
varint [128 128 0] = 16512
@googlebot
Copy link
Collaborator

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@dsnet
Copy link
Member

dsnet commented Mar 9, 2018

The new logic is handling varints incorrectly. I'm not sure what this is trying to achieve.

The binary.PutUvarint function uses the same varint encoding as protos:

	var arr [10]byte
	b := arr[:binary.PutUvarint(arr[:], 16512)]
	fmt.Println(b) // [128 129 1]

Its output disagrees with what your change does.

@dsnet dsnet closed this Mar 9, 2018
@ivan386
Copy link
Author

ivan386 commented Mar 9, 2018

Maybe I chose the wrong place for my proposal. This is new more compact varint. All it values is unique. MSB now used in value calc.

Maybe need to add it as new functions DecodeCompactVarint and EncodeCompactVarint.

@dsnet
Copy link
Member

dsnet commented Mar 9, 2018

This is the wrong place for this. Please submit wire format encoding proposals to the issue tracker at github.com/google/protobuf.

@ivan386
Copy link
Author

ivan386 commented Mar 9, 2018

Done: protocolbuffers/protobuf#4376

@golang golang locked and limited conversation to collaborators Jun 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants