-
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
doc: fix buf.readInt16LE output #5282
Conversation
Previous example didn't account for the 1 byte offset
@@ -728,7 +728,7 @@ const buf = new Buffer([1,-2,3,4]); | |||
buf.readInt16BE(); | |||
// returns 510 | |||
buf.readInt16LE(1); | |||
// returns -511 | |||
// returns 1022 |
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 the original intent was to read the same two bytes.
cc @jasnell who I believe added this example.
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.
Gotcha. Will update to whatever @jasnell thinks here
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.
Yep, this was a typo on my part... the second one should be buf.readInt16LE();
(no argument passed in)
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.
that said, this change works too
LGTM |
LGTM, landed in 8b1af2f. |
Previous example didn't account for the 1 byte offset PR-URL: #5282 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
Previous example didn't account for the 1 byte offset PR-URL: #5282 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
Previous example didn't account for the 1 byte offset PR-URL: #5282 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
Previous example didn't account for the 1 byte offset PR-URL: #5282 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
Previous example didn't account for the 1 byte offset PR-URL: #5282 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
No description provided.