Comparing version 0.1.10-20191216035342.commit-c419e44 to 0.1.10-20191218194952.commit-3097495
export declare function readString(memory: ArrayBuffer, offset: number): string; | ||
export declare function writeStringToHeap(instance: any, value: string): any; | ||
export declare function readBytes(memory: ArrayBuffer, offset: number): number[]; | ||
export declare function hexDump(memory: ArrayBuffer, max?: number, start?: number): string; |
@@ -20,2 +20,19 @@ "use strict"; | ||
exports.readString = readString; | ||
function writeStringToHeap(instance, value) { | ||
const allocatedString = instance.exports.malloc(4 + value.length); | ||
// UCS16 | ||
const dv = new DataView(instance.exports.memory.buffer, allocatedString); | ||
let len = value.length; | ||
dv.setUint32(0, len, true); | ||
let currentOffset = 4; | ||
len += 4; | ||
let i = 0; | ||
while (currentOffset < len) { | ||
dv.setUint16(currentOffset, value.charCodeAt(i), true); | ||
currentOffset += 2; | ||
i++; | ||
} | ||
return allocatedString; | ||
} | ||
exports.writeStringToHeap = writeStringToHeap; | ||
function readBytes(memory, offset) { | ||
@@ -22,0 +39,0 @@ const dv = new DataView(memory, offset); |
{ | ||
"name": "lys", | ||
"version": "0.1.10-20191216035342.commit-c419e44", | ||
"version": "0.1.10-20191218194952.commit-3097495", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
896432
10235