mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-04-28 15:12:16 +00:00
Tighten up getStringFromWasm a bit
no need for some extra locals here
This commit is contained in:
parent
978b5ada63
commit
1ff9ccf072
@ -697,10 +697,7 @@ impl<'a> Context<'a> {
|
|||||||
self.expose_uint8_memory();
|
self.expose_uint8_memory();
|
||||||
self.globals.push_str(&format!("
|
self.globals.push_str(&format!("
|
||||||
function getStringFromWasm(ptr, len) {{
|
function getStringFromWasm(ptr, len) {{
|
||||||
const mem = getUint8Memory();
|
return textDecoder().decode(getUint8Memory().slice(ptr, ptr + len));
|
||||||
const slice = mem.slice(ptr, ptr + len);
|
|
||||||
const ret = textDecoder().decode(slice);
|
|
||||||
return ret;
|
|
||||||
}}
|
}}
|
||||||
"));
|
"));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user