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

Add support for 64bit integer to hex formatting #233

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

Conversation

lvcabral
Copy link

@lvcabral lvcabral commented Jan 8, 2025

This PR fixes #221

arg = (parseInt(arg, 10) >>> 0).toString(16).toUpperCase()
high = "0"
if (parseInt(arg, 10) > MAXINT - 1 || parseInt(arg, 10) < -MAXINT) {
high = BigInt.asUintN(32, BigInt(arg) >> BigInt(32)).toString(16) // eslint-disable-line
Copy link
Author

@lvcabral lvcabral Jan 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to disable lint in this line because the eslint version on this repo does not recognize BigInt, but it is available in all browsers and platforms already: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt

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.

Conversion error on large number (> 32bit)
1 participant