@wasmgroundup/emit 0.4.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +3 -5
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -16,6 +16,7 @@ export function version() {
|
|
|
16
16
|
|
|
17
17
|
export const CONTINUATION_BIT = 0b10000000;
|
|
18
18
|
export const SEVEN_BIT_MASK_BIG_INT = 0b01111111n;
|
|
19
|
+
|
|
19
20
|
export function leb128(v) {
|
|
20
21
|
let val = BigInt(v);
|
|
21
22
|
let more = true;
|
|
@@ -37,6 +38,7 @@ export function leb128(v) {
|
|
|
37
38
|
|
|
38
39
|
export const MIN_U32 = 0;
|
|
39
40
|
export const MAX_U32 = 2 ** 32 - 1;
|
|
41
|
+
|
|
40
42
|
export function u32(v) {
|
|
41
43
|
if (v < MIN_U32 || v > MAX_U32) {
|
|
42
44
|
throw Error(`Value out of range for u32: ${v}`);
|
|
@@ -70,6 +72,7 @@ export function sleb128(v) {
|
|
|
70
72
|
export const MIN_I32 = -(2 ** 32 / 2);
|
|
71
73
|
export const MAX_I32 = 2 ** 32 / 2 - 1;
|
|
72
74
|
export const I32_NEG_OFFSET = 2 ** 32;
|
|
75
|
+
|
|
73
76
|
export function i32(v) {
|
|
74
77
|
if (v < MIN_I32 || v > MAX_U32) {
|
|
75
78
|
throw Error(`Value out of range for i32: ${v}`);
|
|
@@ -408,11 +411,6 @@ export function elem(x, e, ys) {
|
|
|
408
411
|
export function elemsec(segs) {
|
|
409
412
|
return section(SECTION_ID_ELEMENT, vec(segs));
|
|
410
413
|
}
|
|
411
|
-
export function assert(cond, msg) {
|
|
412
|
-
if (!cond) {
|
|
413
|
-
throw new Error(msg);
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
414
|
|
|
417
415
|
instr.local ??= {};
|
|
418
416
|
instr.global ??= {};
|