-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
buffer: fix value check for writeUInt{B,L}E #3500
Conversation
if (!noAssert) | ||
checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0); | ||
checkInt(this, value, offset, byteLength, maxBytes, 0); |
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.
I think Crankshaft and TurboFan are smart enough to move the Math.pow() call to the use site but the baseline compiler probably isn't, which would mean an extra Math.pow() call in the (unoptimized) common case.
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.
oh whoops. I just moved it b/c it didn't fit in 80 chars, but brain farted that i moved it outside the if. will fix.
@trevnorris ... would you want this in v4.x? |
@jasnell bug fix, so I think so. |
3d2fd99
to
425d681
Compare
@bnoordhuis Addressed comments. New CI: https://ci.nodejs.org/job/node-test-pull-request/620/ |
Two unrelated failures. Everything else looks good. |
540da8d
to
67d4e96
Compare
LGTM. Consider adding tests for byteLength > 1. |
I only see tests for byteLength == 0 and 1 or am I missing something? |
67d4e96
to
559e66b
Compare
Fixes: #3497 PR-URL: #3500 Reviewed-By: Ben Noordhuis <[email protected]>
Thanks for the review. Landed in 3308e5e. |
Fixes: #3497 PR-URL: #3500 Reviewed-By: Ben Noordhuis <[email protected]>
Fixes: #3497 PR-URL: #3500 Reviewed-By: Ben Noordhuis <[email protected]>
Landed in v4.x-staging bc2120c |
Fixes: #3497 PR-URL: #3500 Reviewed-By: Ben Noordhuis <[email protected]>
Fixes: #3497
CI: https://ci.nodejs.org/job/node-test-pull-request/583/