-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix byte order for big-endian platforms #4015
Conversation
1c10293
to
85877e3
Compare
d15a159
to
0b99b3e
Compare
> [!NOTE] > We should remove this if rustwasm/wasm-bindgen#4015 get mereged.
Could you review this pull request? @daxpedda |
4ca91d6
to
fabe89c
Compare
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'm a bit confused why you chose not to re-use expose_*_memory()
.
The only place it still seems to be used is for importing arrays, which you actually haven't covered here.
I will have more time tomorrow to look into this properly.
Could you review this pull request? @daxpedda
I apologize for the delay, my backlog from my vacation was quite big and I'm just getting to it.
Could you please specify which part you're referring to? Marking it on the relevant code would be helpful. |
All these functions could be adapted: wasm-bindgen/crates/cli-support/src/js/mod.rs Lines 1782 to 1812 in 7f3c21b
The corresponding |
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.
My earlier assumptions were wrong, when getting arrays out of Wasm to JS land, we can't actually use DataView
, this is a responsibility the user will have to take when extracting data from DataView
.
5f93ead
to
925fc07
Compare
Note
WebAssembly memory is always in little-endian format, regardless of the platform it's run on. Therefore, for portability, you should read and write multi-byte values in JavaScript using DataView.
https://developer.mozilla.org/en-US/docs/WebAssembly/JavaScript_interface/Memory
Related issues:
@swc/wasm-typescript
is failing on some architectures swc-project/swc#9259