Ecma262: Typed Array: What about i64?

Created on 28 Sep 2018  路  2Comments  路  Source: tc39/ecma262

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

Most helpful comment

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

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

All 2 comments

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.

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

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

Was this page helpful?
0 / 5 - 0 ratings