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

Unintuitive ordering of signed integers in keys #63

Closed
webmaster128 opened this issue Sep 18, 2024 · 1 comment · Fixed by #76
Closed

Unintuitive ordering of signed integers in keys #63

webmaster128 opened this issue Sep 18, 2024 · 1 comment · Fixed by #76
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@webmaster128
Copy link
Member

Right now, Key is implemented for signed integer types using a straight forward BE encoding. However, this leads to the following iteration order:

  • 0
  • 1 … iXX::MAX
  • iXX::MIN … -1

So the negative numbers sorted after the positive ones.

In cw-storage-plus this is avaided by a custom binary encoding for signed integers (some smart trick I never looked into in detail).

I think we should address this somehow to avoid unexpected iteration order. Either by implementing what we do in cw-storage-plus, remove support for signed integers or something better.

@uint uint added this to the v0.4.0 milestone Sep 23, 2024
@uint
Copy link
Collaborator

uint commented Sep 23, 2024

Yeah, I missed that. Sounds both high prio and easy to do.

@uint uint added bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed labels Sep 23, 2024
uint added a commit that referenced this issue Oct 14, 2024
@uint uint closed this as completed in #76 Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants