-
Notifications
You must be signed in to change notification settings - Fork 145
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
Check sign flag for i{8, 16, 32, ...} conversions #1867
Conversation
@@ -23,7 +23,7 @@ export function u8aToBigInt (value: Uint8Array, { isLe = true, isNegative = fals | |||
: value.slice().reverse(); | |||
const count = u8a.length; | |||
|
|||
if (isNegative && (!count || (u8a[count - 1] & 0x80))) { | |||
if (isNegative && count && (u8a[count - 1] & 0x80)) { |
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.
So to understand this, isNegative
will not indicate if we want to convert a signed
value, correct?
If so maybe it would be good to refactor the name to isSigned
and deprecate isNegative
option?
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.
The naming isNegative
is indeed very unfortunate, it does mean isSigned
and should have been named such 5 year ago. Got it right eventually in the api.
The timelines for deprecation (at least 6 months and then in the next major) and then the additional clutches it brings code & maintenance wise to support old/new has newer seemed to be worth the effort. So it is a wart.
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Replaces #1866