-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy pathadd.js
87 lines (79 loc) · 2.33 KB
/
add.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
let wasm;
export function __wbg_set_wasm(val) {
wasm = val;
}
/**
* @param {number} a
* @param {number} b
* @returns {number}
*/
export function add_u32(a, b) {
const ret = wasm.add_u32(a, b);
return ret >>> 0;
}
/**
* @param {number} a
* @param {number} b
* @returns {number}
*/
export function add_i32(a, b) {
const ret = wasm.add_i32(a, b);
return ret;
}
/**
* @param {bigint | number} a
* @param {bigint | number} b
* @returns {bigint}
*/
export function add_u64(a, b) {
const bigint0 = typeof a === 'number' ? BigInt(Math.trunc(a)) : a;
const bigint1 = typeof b === 'number' ? BigInt(Math.trunc(b)) : b;
const ret = wasm.add_u64(bigint0, bigint1);
return BigInt.asUintN(64, ret);
}
/**
* @param {bigint | number} a
* @param {bigint | number} b
* @returns {bigint}
*/
export function add_i64(a, b) {
const bigint0 = typeof a === 'number' ? BigInt(Math.trunc(a)) : a;
const bigint1 = typeof b === 'number' ? BigInt(Math.trunc(b)) : b;
const ret = wasm.add_i64(bigint0, bigint1);
return ret;
}
function isLikeNone(x) {
return x === undefined || x === null;
}
/**
* @param {bigint | number | null | undefined} a
* @param {bigint | number} b
* @returns {bigint | undefined}
*/
export function add_option_u64(a, b) {
const bigint0 = typeof a === 'number' ? BigInt(Math.trunc(a)) : a;
const bigint1 = typeof b === 'number' ? BigInt(Math.trunc(b)) : b;
const ret = wasm.add_option_u64(!isLikeNone(bigint0), isLikeNone(bigint0) ? BigInt(0) : bigint0, bigint1);
return ret[0] === 0 ? undefined : BigInt.asUintN(64, ret[1]);
}
/**
* @param {bigint | number | null | undefined} a
* @param {bigint | number} b
* @returns {bigint | undefined}
*/
export function add_option_i64(a, b) {
const bigint0 = typeof a === 'number' ? BigInt(Math.trunc(a)) : a;
const bigint1 = typeof b === 'number' ? BigInt(Math.trunc(b)) : b;
const ret = wasm.add_option_i64(!isLikeNone(bigint0), isLikeNone(bigint0) ? BigInt(0) : bigint0, bigint1);
return ret[0] === 0 ? undefined : ret[1];
}
export function __wbindgen_init_externref_table() {
const table = wasm.__wbindgen_export_0;
const offset = table.grow(4);
table.set(0, undefined);
table.set(offset + 0, undefined);
table.set(offset + 1, null);
table.set(offset + 2, true);
table.set(offset + 3, false);
;
};