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

Typed Array: What about i64? #1316

Closed
lorenzleutgeb opened this Issue Sep 28, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@lorenzleutgeb

lorenzleutgeb commented Sep 28, 2018

I am writing JavaScript code that interfaces with WebAssembly. The WebAssembly memory is exposed as an ArrayBuffer which I wrap in a Uint8Array and a DataView for access.

WebAssembly values are typed as i32, i64, f32, f64. Three of them are nicely mirrored in the typed array world and WebIDL. However, i64 is missing the Int64Array, Uint64Array and DataView.setInt64, DataView.setUint64 counterparts.

I tried to find out why they are not standardized, but was not successful. In my opinion that would be a reasonable addition.

I see that JavaScript's Number.MAX_SAFE_INTEGER is less than 2^64, is that the "reason"? Writing values up to that number to some buffer using DataView.set(Ui|I)nt64 should not be a problem, reading unsafe integers however requires consideration.


Note that I arrived here via a slight detour through heycam/webidl#586

@devsnek

This comment has been minimized.

Show comment
Hide comment
@devsnek

devsnek Sep 28, 2018

Contributor

JS number values are ieee754 floating point. BigInt however is stage 3 and adds Big(U)Int64Array. cc @linclark on any story involving i64 and bigint.

Contributor

devsnek commented Sep 28, 2018

JS number values are ieee754 floating point. BigInt however is stage 3 and adds Big(U)Int64Array. cc @linclark on any story involving i64 and bigint.

@lorenzleutgeb

This comment has been minimized.

Show comment
Hide comment
@lorenzleutgeb

lorenzleutgeb Sep 28, 2018

OK, I think that additions like DataView.setBigInt64 et. al. would serve my purposes.

Also I discovered WebAssembly/spec#707. Sorry for the noise.

lorenzleutgeb commented Sep 28, 2018

OK, I think that additions like DataView.setBigInt64 et. al. would serve my purposes.

Also I discovered WebAssembly/spec#707. Sorry for the noise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment