@tybys/wasm-util 0.7.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/wasm-util.d.ts +12 -6
- package/dist/wasm-util.esm-bundler.js +78 -39
- package/dist/wasm-util.esm.js +78 -39
- package/dist/wasm-util.esm.min.js +1 -1
- package/dist/wasm-util.js +78 -38
- package/dist/wasm-util.min.js +1 -1
- package/lib/cjs/load.js +24 -13
- package/lib/cjs/wasi/index.js +47 -25
- package/lib/cjs/wasi/preview1.js +8 -1
- package/lib/mjs/load.mjs +24 -13
- package/lib/mjs/wasi/index.mjs +46 -25
- package/lib/mjs/wasi/preview1.mjs +8 -1
- package/package.json +1 -1
|
@@ -456,7 +456,14 @@ export class WASI {
|
|
|
456
456
|
return WasiErrno.EINVAL;
|
|
457
457
|
}
|
|
458
458
|
buf_len = Number(buf_len);
|
|
459
|
-
const { HEAPU8 } = getMemory(this);
|
|
459
|
+
const { HEAPU8, view } = getMemory(this);
|
|
460
|
+
if ((typeof SharedArrayBuffer === 'function' && HEAPU8.buffer instanceof SharedArrayBuffer) ||
|
|
461
|
+
(Object.prototype.toString.call(HEAPU8.buffer) === '[object SharedArrayBuffer]')) {
|
|
462
|
+
for (let i = buf; i < buf + buf_len; ++i) {
|
|
463
|
+
view.setUint8(i, Math.floor(Math.random() * 256));
|
|
464
|
+
}
|
|
465
|
+
return WasiErrno.ESUCCESS;
|
|
466
|
+
}
|
|
460
467
|
let pos;
|
|
461
468
|
const stride = 65536;
|
|
462
469
|
for (pos = 0; pos + stride < buf_len; pos += stride) {
|