Server IP : 85.214.239.14 / Your IP : 18.216.160.84 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/3/cwd/lib/node_modules/pm2/node_modules/@tootallnate/quickjs-emscripten/dist/ |
Upload File : |
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ModuleMemory = void 0; const lifetime_1 = require("./lifetime"); /** * @private */ class ModuleMemory { constructor(module) { this.module = module; } toPointerArray(handleArray) { const typedArray = new Int32Array(handleArray.map((handle) => handle.value)); const numBytes = typedArray.length * typedArray.BYTES_PER_ELEMENT; const ptr = this.module._malloc(numBytes); var heapBytes = new Uint8Array(this.module.HEAPU8.buffer, ptr, numBytes); heapBytes.set(new Uint8Array(typedArray.buffer)); return new lifetime_1.Lifetime(ptr, undefined, (ptr) => this.module._free(ptr)); } newMutablePointerArray(length) { const zeros = new Int32Array(new Array(length).fill(0)); const numBytes = zeros.length * zeros.BYTES_PER_ELEMENT; const ptr = this.module._malloc(numBytes); const typedArray = new Int32Array(this.module.HEAPU8.buffer, ptr, length); typedArray.set(zeros); return new lifetime_1.Lifetime({ typedArray, ptr }, undefined, (value) => this.module._free(value.ptr)); } newHeapCharPointer(string) { const numBytes = this.module.lengthBytesUTF8(string) + 1; const ptr = this.module._malloc(numBytes); this.module.stringToUTF8(string, ptr, numBytes); return new lifetime_1.Lifetime(ptr, undefined, (value) => this.module._free(value)); } consumeHeapCharPointer(ptr) { const str = this.module.UTF8ToString(ptr); this.module._free(ptr); return str; } } exports.ModuleMemory = ModuleMemory; //# sourceMappingURL=memory.js.map