Skip to content

Commit

Permalink
Updates files generated by wasm-pack
Browse files Browse the repository at this point in the history
  • Loading branch information
raugfer committed Oct 3, 2024
1 parent f55545a commit f28d169
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 31 deletions.
50 changes: 20 additions & 30 deletions tools/npm/garaga_ts/src/wasm/pkg/garaga_rs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
let wasm;

const heap = new Array(128).fill(undefined);

heap.push(undefined, null, true, false);

function getObject(idx) { return heap[idx]; }

let heap_next = heap.length;

function dropObject(idx) {
if (idx < 132) return;
heap[idx] = heap_next;
heap_next = idx;
}

function takeObject(idx) {
const ret = getObject(idx);
dropObject(idx);
return ret;
}

const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );

if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
Expand All @@ -18,12 +38,6 @@ function getStringFromWasm0(ptr, len) {
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
}

const heap = new Array(128).fill(undefined);

heap.push(undefined, null, true, false);

let heap_next = heap.length;

function addHeapObject(obj) {
if (heap_next === heap.length) heap.push(heap.length + 1);
const idx = heap_next;
Expand All @@ -33,20 +47,6 @@ function addHeapObject(obj) {
return idx;
}

function getObject(idx) { return heap[idx]; }

function dropObject(idx) {
if (idx < 132) return;
heap[idx] = heap_next;
heap_next = idx;
}

function takeObject(idx) {
const ret = getObject(idx);
dropObject(idx);
return ret;
}

let WASM_VECTOR_LEN = 0;

const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
Expand Down Expand Up @@ -258,9 +258,6 @@ export function mpc_calldata_builder(curve_id, values1, n_fixed_g2, values2) {
var v3 = getArrayJsValueFromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 4, 4);
return v3;
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 4, 4);
return v1;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
Expand Down Expand Up @@ -348,10 +345,6 @@ async function __wbg_load(module, imports) {
function __wbg_get_imports() {
const imports = {};
imports.wbg = {};
imports.wbg.__wbindgen_bigint_from_str = function(arg0, arg1) {
const ret = BigInt(getStringFromWasm0(arg0, arg1));
return addHeapObject(ret);
};
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
takeObject(arg0);
};
Expand All @@ -363,9 +356,6 @@ function __wbg_get_imports() {
const ret = getObject(arg0) + getObject(arg1);
return addHeapObject(ret);
};
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
takeObject(arg0);
};
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
const obj = getObject(arg1);
const ret = typeof(obj) === 'string' ? obj : undefined;
Expand Down
2 changes: 1 addition & 1 deletion tools/npm/garaga_ts/src/wasm/pkg/garaga_rs_bg.wasm.js

Large diffs are not rendered by default.

0 comments on commit f28d169

Please sign in to comment.