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

64bit key support with bigints #145

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

matthewaveryusa
Copy link

As discussed in #111. I didn't implement defaulting bigints to buffers since there's no easy v8 api to transform a bigint into an array of bytes. I'm guessing v8 doesn't expose such an API to avoid making an opinionated choice on how to store signed numbers in binary format (the logical options being either twos compliment or signbit+unsignedbytes.)

With that in mind I think the correct approach is to allow users to choose how they want to serialize bigints. The obvious easy answer it to use the toString() method at the cost of some extra memory and ordering, or to store the data as a binary key by doing Buffer.from(1n.toString(16),'hex') if they are unsigned bigints, and coming up with a sign-ness encoding/decoding if they are signed.

@matthewaveryusa matthewaveryusa changed the title 64bit key support with bignums 64bit key support with bigints Mar 29, 2019
@Venemo
Copy link
Owner

Venemo commented May 23, 2019

Sorry for the late reply. Will review this as soon as I can.

@matthewaveryusa
Copy link
Author

No worries. This patch will need some reworking as it touches the same areas in the codebase as the async pull request #150

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

Successfully merging this pull request may close these issues.

2 participants