-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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
Fixes an issue where Buffer.from was not supporting SharedArrayBuffer #8510
Changes from 3 commits
699b605
7a1e765
ff3555f
ce9aa0b
a66a3e0
bdfaa52
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/*global SharedArrayBuffer*/ | ||
'use strict'; | ||
// Flags: --harmony-sharedarraybuffer | ||
|
||
require('../common'); | ||
const assert = require('assert'); | ||
const Buffer = require('buffer').Buffer; | ||
|
||
const sab = new SharedArrayBuffer(24); | ||
const arr = new Uint16Array(sab); | ||
const ar = new Uint16Array(12); | ||
ar[0] = 5000; | ||
arr[0] = 5000; | ||
arr[1] = 4000; | ||
ar[1] = 4000; | ||
|
||
var arr_buf = Buffer.from(arr.buffer); | ||
var ar_buf = Buffer.from(ar.buffer); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think these can be |
||
|
||
assert.deepStrictEqual(arr_buf, ar_buf, 0); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can probably leave the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Being explicit is better when checking for things. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
|
||
arr[1] = 6000; | ||
ar[1] = 6000; | ||
|
||
assert.deepStrictEqual(arr_buf, ar_buf, 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.
Just a suggestion, maybe it would be more readable to call them
arr1
andarr2
?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.
Sure will do that soon. Better readability I guess.