MCPcopy Create free account
hub / github.com/antimatter15/ocrad.js / UTF16ToString

Function UTF16ToString

ocrad.js:904–916  ·  view source on GitHub ↗
(ptr)

Source from the content-addressed store, hash-verified

902// a copy of that string as a Javascript String object.
903
904function UTF16ToString(ptr) {
905 var i = 0;
906
907 var str = '';
908 while (1) {
909 var codeUnit = HEAP16[(((ptr)+(i*2))>>1)];
910 if (codeUnit == 0)
911 return str;
912 ++i;
913 // fromCharCode constructs a character from a UTF-16 code unit, so we can pass the UTF16 string right through.
914 str += String.fromCharCode(codeUnit);
915 }
916}
917
918
919// Copies the given Javascript String object 'str' to the emscripten HEAP at address 'outPtr',

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected