-
-
Notifications
You must be signed in to change notification settings - Fork 682
Open
Labels
@geraintluff
Description
Feature suggestion
I'd love a syntax like this:
let utf8Ptr = memory.data<u8>("Hello"); let utf16Ptr = memory.data<u16>("Hello");
At the moment I'm doing this at runtime instead:
let bytes = String.UTF8.byteLength(str, true); let utf8Ptr = heap.alloc(bytes); String.UTF8.encodeUnsafe(changetype<usize>(str), str.length, utf8Ptr, true);
I could use String.UTF8.encode() instead, and then store the ArrayBuffer so it doesn't get GC'd, but as far as I can tell, that still ends up embedding the UTF-16 string in the output.