-
Notifications
You must be signed in to change notification settings - Fork 187
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
Improve .toString(2) performance #178
base: master
Are you sure you want to change the base?
Conversation
2 similar comments
BigInteger.js
Outdated
@@ -1314,6 +1314,7 @@ var bigInt = (function (undefined) { | |||
|
|||
BigInteger.prototype.toString = function (radix, alphabet) { | |||
if (radix === undefined) radix = 10; | |||
if (radix === 2) return (this.sign ? "-" : "") + this.toArray(2).value.join(''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about the alphabet
argument?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yes i did not consider that. I updated it to only apply the optimization if the alphabet parameter is not provided. That may be a bit hacky now, whatcha think?
Good point @Yaffle, that makes me realize that the |
No description provided.