(arg, malloc, realloc)
| 75 | }); |
| 76 | |
| 77 | function passStringToWasm0(arg, malloc, realloc) { |
| 78 | |
| 79 | if (realloc === undefined) { |
| 80 | const buf = cachedTextEncoder.encode(arg); |
| 81 | const ptr = malloc(buf.length, 1) >>> 0; |
| 82 | getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf); |
| 83 | WASM_VECTOR_LEN = buf.length; |
| 84 | return ptr; |
| 85 | } |
| 86 | |
| 87 | let len = arg.length; |
| 88 | let ptr = malloc(len, 1) >>> 0; |
| 89 | |
| 90 | const mem = getUint8Memory0(); |
| 91 | |
| 92 | let offset = 0; |
| 93 | |
| 94 | for (; offset < len; offset++) { |
| 95 | const code = arg.charCodeAt(offset); |
| 96 | if (code > 0x7F) break; |
| 97 | mem[ptr + offset] = code; |
| 98 | } |
| 99 | |
| 100 | if (offset !== len) { |
| 101 | if (offset !== 0) { |
| 102 | arg = arg.slice(offset); |
| 103 | } |
| 104 | ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0; |
| 105 | const view = getUint8Memory0().subarray(ptr + offset, ptr + len); |
| 106 | const ret = encodeString(arg, view); |
| 107 | |
| 108 | offset += ret.written; |
| 109 | } |
| 110 | |
| 111 | WASM_VECTOR_LEN = offset; |
| 112 | return ptr; |
| 113 | } |
| 114 | |
| 115 | const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; |
| 116 |
no test coverage detected