@wasmgroundup/emit 0.2.16 → 0.2.18

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/dist/index.d.ts CHANGED
@@ -27,6 +27,7 @@ declare const exportdesc: {
27
27
  };
28
28
  declare function module(sections: any): BytecodeFragment;
29
29
  declare const instr: {
30
+ unreachable: number;
30
31
  nop: number;
31
32
  block: number;
32
33
  loop: number;
@@ -40,6 +41,7 @@ declare const instr: {
40
41
  call: number;
41
42
  call_indirect: number;
42
43
  drop: number;
44
+ select: number;
43
45
  local: {
44
46
  get: number;
45
47
  set: number;
@@ -75,12 +77,14 @@ declare const instr: {
75
77
  i64: {
76
78
  store32: number;
77
79
  const: number;
80
+ ne: number;
78
81
  add: number;
79
82
  sub: number;
80
83
  mul: number;
81
84
  };
82
85
  f32: {
83
86
  const: number;
87
+ ne: number;
84
88
  add: number;
85
89
  sub: number;
86
90
  mul: number;
@@ -90,6 +94,7 @@ declare const instr: {
90
94
  load: number;
91
95
  store: number;
92
96
  const: number;
97
+ ne: number;
93
98
  add: number;
94
99
  sub: number;
95
100
  mul: number;
package/dist/index.js CHANGED
@@ -97,6 +97,7 @@ function module(sections) {
97
97
  return [magic(), version(), sections];
98
98
  }
99
99
  const instr = {
100
+ unreachable: 0x00,
100
101
  nop: 0x01,
101
102
  block: 0x02,
102
103
  loop: 0x03,
@@ -110,6 +111,7 @@ const instr = {
110
111
  call: 0x10,
111
112
  call_indirect: 0x11,
112
113
  drop: 0x1a,
114
+ select: 0x1b,
113
115
  local: {
114
116
  get: 0x20,
115
117
  set: 0x21,
@@ -145,12 +147,14 @@ const instr = {
145
147
  i64: {
146
148
  store32: 0x3e,
147
149
  const: 0x42,
150
+ ne: 0x52,
148
151
  add: 0x7c,
149
152
  sub: 0x7d,
150
153
  mul: 0x7e,
151
154
  },
152
155
  f32: {
153
156
  const: 0x43,
157
+ ne: 0x5c,
154
158
  add: 0x92,
155
159
  sub: 0x93,
156
160
  mul: 0x94,
@@ -160,6 +164,7 @@ const instr = {
160
164
  load: 0x2b,
161
165
  store: 0x39,
162
166
  const: 0x44,
167
+ ne: 0x62,
163
168
  add: 0xa0,
164
169
  sub: 0xa1,
165
170
  mul: 0xa2,
package/index.test.ts CHANGED
@@ -25,6 +25,7 @@ import {
25
25
  mut,
26
26
  typeidx,
27
27
  typesec,
28
+ u32,
28
29
  valtype,
29
30
  } from "./index";
30
31
 
@@ -34,6 +35,17 @@ function fragmentToUInt8Array(frag: BytecodeFragment): Uint8Array {
34
35
  return Uint8Array.from((frag as any).flat(Infinity));
35
36
  }
36
37
 
38
+ test("u32", () => {
39
+ expect(u32(32768)).toEqual([128, 128, 2]);
40
+ expect(u32(2 ** 32 - 1)).toEqual([255, 255, 255, 255, 15]);
41
+ });
42
+
43
+ test("i32", () => {
44
+ expect(i32(32768)).toEqual([128, 128, 2]);
45
+ expect(i32(2 ** 31 - 1)).toEqual([255, 255, 255, 255, 7]);
46
+ expect(i32(-(2 ** 31 - 1))).toEqual([129, 128, 128, 128, 120]);
47
+ });
48
+
37
49
  test("simple modules", async () => {
38
50
  const makeModule = (paramTypes, resultTypes, body) => {
39
51
  const mod = module([
package/index.ts CHANGED
@@ -127,6 +127,7 @@ function module(sections): BytecodeFragment {
127
127
  }
128
128
 
129
129
  const instr = {
130
+ unreachable: 0x00,
130
131
  nop: 0x01,
131
132
  block: 0x02,
132
133
  loop: 0x03,
@@ -140,6 +141,7 @@ const instr = {
140
141
  call: 0x10,
141
142
  call_indirect: 0x11,
142
143
  drop: 0x1a,
144
+ select: 0x1b,
143
145
 
144
146
  local: {
145
147
  get: 0x20,
@@ -177,12 +179,14 @@ const instr = {
177
179
  i64: {
178
180
  store32: 0x3e,
179
181
  const: 0x42,
182
+ ne: 0x52,
180
183
  add: 0x7c,
181
184
  sub: 0x7d,
182
185
  mul: 0x7e,
183
186
  },
184
187
  f32: {
185
188
  const: 0x43,
189
+ ne: 0x5c,
186
190
  add: 0x92,
187
191
  sub: 0x93,
188
192
  mul: 0x94,
@@ -192,6 +196,7 @@ const instr = {
192
196
  load: 0x2b,
193
197
  store: 0x39,
194
198
  const: 0x44,
199
+ ne: 0x62,
195
200
  add: 0xa0,
196
201
  sub: 0xa1,
197
202
  mul: 0xa2,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wasmgroundup/emit",
3
3
  "description": "A library for creating binary-encoded WebAssembly modules",
4
- "version": "0.2.16",
4
+ "version": "0.2.18",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",