-
-
Notifications
You must be signed in to change notification settings - Fork 667
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
How to read the real byteOffset
?
#928
Comments
|
Great, I see in docs https://docs.assemblyscript.org/details/memory#arraybufferview-layout there should be also
I ended up with: read_bytes(
value.dataStart,
value.byteLength
); |
Yes. That chapter required updates. |
I have follow up question here. How to reproduce |
// for Uint8Array
const arr = Uint8Array.wrap(
changetype<ArrayBuffer>(value.dataStart),
value.byteOffset, // or `0`
value.byteLength // same value.byteLength >> alignof<u8>() or value.length
)
// for Uint32Array
const arr = Uint32Array.wrap(
changetype<ArrayBuffer>(value.dataStart),
value.byteOffset, // or `0`
value.byteLength >> alignof<u32>() // or value.length
)
// and etc |
Thank you one more time. |
Nice! |
I try to read an array of bytes on my host:
I expected
byteOffset
to return a point in WASM memory where structure starts, but it doesn't work like that.I have the solution, that works fine in Rust:
Is it possible to have something similar in AssemblyScript?
The text was updated successfully, but these errors were encountered: