chore (wasi): wasm bigint issue

ecmscripten has this flag "-sWASM_BIGINT=1" which make functions like
fd_pread and seek to have different signature where the uint64 offset
are represented as offset_lo and offset_hi. With this flag, the offset
become of type BigInt
This commit is contained in:
MickaelK 2025-04-25 10:18:09 +10:00
parent e63ff46c6d
commit c7c7113f52

View file

@ -291,14 +291,14 @@ export class Wasi {
return 0;
}
fd_pread(fd, iovs, iovs_len, offset64, nread) {
fd_pread(fd, iovs, iovs_len, offset_lo, offset_hi, nread) {
const file = FS[fd];
if (!file) {
console.error(`Invalid fd: ${fd}`);
return -1;
}
const start = Number(offset64);
const start = (offset_hi >>> 0) * 0x100000000 + (offset_lo >>> 0);
const ioVec = new Uint32Array(this.#instance.exports.memory.buffer, iovs, iovs_len * 2);
const mem = new Uint8Array(this.#instance.exports.memory.buffer);