-const encodeArray = (inputArray) => {
- const cArrayPointer = wasm.wasm_malloc((inputArray.length + 1) * 4);
- const arrayMemoryView = new Uint32Array(memory.buffer, cArrayPointer + 4, inputArray.length);
+const encodeUint8Array = (inputArray) => {
+ const cArrayPointer = wasm.TS_malloc(inputArray.length + 4);
+ const arrayLengthView = new Uint32Array(memory.buffer, cArrayPointer, 1);
+ arrayLengthView[0] = inputArray.length;
+ const arrayMemoryView = new Uint8Array(memory.buffer, cArrayPointer + 4, inputArray.length);
+ arrayMemoryView.set(inputArray);
+ return cArrayPointer;
+}
+
+const encodeUint32Array = (inputArray) => {
+ const cArrayPointer = wasm.TS_malloc((inputArray.length + 1) * 4);
+ const arrayMemoryView = new Uint32Array(memory.buffer, cArrayPointer, inputArray.length);