(arg, malloc, realloc)
| 62 | }); |
| 63 | |
| 64 | function passStringToWasm0(arg, malloc, realloc) { |
| 65 | |
| 66 | if (realloc === undefined) { |
| 67 | const buf = cachedTextEncoder.encode(arg); |
| 68 | const ptr = malloc(buf.length, 1) >>> 0; |
| 69 | getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf); |
| 70 | WASM_VECTOR_LEN = buf.length; |
| 71 | return ptr; |
| 72 | } |
| 73 | |
| 74 | let len = arg.length; |
| 75 | let ptr = malloc(len, 1) >>> 0; |
| 76 | |
| 77 | const mem = getUint8Memory0(); |
| 78 | |
| 79 | let offset = 0; |
| 80 | |
| 81 | for (; offset < len; offset++) { |
| 82 | const code = arg.charCodeAt(offset); |
| 83 | if (code > 0x7F) break; |
| 84 | mem[ptr + offset] = code; |
| 85 | } |
| 86 | |
| 87 | if (offset !== len) { |
| 88 | if (offset !== 0) { |
| 89 | arg = arg.slice(offset); |
| 90 | } |
| 91 | ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0; |
| 92 | const view = getUint8Memory0().subarray(ptr + offset, ptr + len); |
| 93 | const ret = encodeString(arg, view); |
| 94 | |
| 95 | offset += ret.written; |
| 96 | } |
| 97 | |
| 98 | WASM_VECTOR_LEN = offset; |
| 99 | return ptr; |
| 100 | } |
| 101 | |
| 102 | function isLikeNone(x) { |
| 103 | return x === undefined || x === null; |
no test coverage detected