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

Improvements to encoding of natural numbers #162

Closed
RichardWarburton opened this issue Jan 30, 2019 · 1 comment
Closed

Improvements to encoding of natural numbers #162

RichardWarburton opened this issue Jan 30, 2019 · 1 comment

Comments

@RichardWarburton
Copy link
Contributor

I've been switching Artio codecs over to using Agrona's Ascii number encoding and decoding. I've noticed a couple of missing features that are in Artio that aren't there in the Agrona equivalents relating to natural numbers:

  1. Artio has a putNatural() method that puts a value within a certain size range. So it zero pads the beginning of the size range, and also throws an exception if the value goes out of the range. zero padding can be useful if you've pre-allocated a space within a buffer that you want to encode a number into.

  2. Artio has a putNaturalFromEnd() method that instead of taking a start index, takes an end index and puts the number before that point. This gives you more encoding options, especially if you've got one final field that you want to fill in at the start of an object, eg a length field, that you don't know the encoded size of ahead of time.

Are you interested in PRs for either of these methods or do you consider them too specialized for Agrona?

@mjpt777
Copy link
Contributor

mjpt777 commented Jan 30, 2019

Sure @RichardWarburton send a PR.

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