@wasmgroundup/emit 0.2.17 → 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
@@ -77,12 +77,14 @@ declare const instr: {
77
77
  i64: {
78
78
  store32: number;
79
79
  const: number;
80
+ ne: number;
80
81
  add: number;
81
82
  sub: number;
82
83
  mul: number;
83
84
  };
84
85
  f32: {
85
86
  const: number;
87
+ ne: number;
86
88
  add: number;
87
89
  sub: number;
88
90
  mul: number;
@@ -92,6 +94,7 @@ declare const instr: {
92
94
  load: number;
93
95
  store: number;
94
96
  const: number;
97
+ ne: number;
95
98
  add: number;
96
99
  sub: number;
97
100
  mul: number;
package/dist/index.js CHANGED
@@ -147,12 +147,14 @@ const instr = {
147
147
  i64: {
148
148
  store32: 0x3e,
149
149
  const: 0x42,
150
+ ne: 0x52,
150
151
  add: 0x7c,
151
152
  sub: 0x7d,
152
153
  mul: 0x7e,
153
154
  },
154
155
  f32: {
155
156
  const: 0x43,
157
+ ne: 0x5c,
156
158
  add: 0x92,
157
159
  sub: 0x93,
158
160
  mul: 0x94,
@@ -162,6 +164,7 @@ const instr = {
162
164
  load: 0x2b,
163
165
  store: 0x39,
164
166
  const: 0x44,
167
+ ne: 0x62,
165
168
  add: 0xa0,
166
169
  sub: 0xa1,
167
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
@@ -179,12 +179,14 @@ const instr = {
179
179
  i64: {
180
180
  store32: 0x3e,
181
181
  const: 0x42,
182
+ ne: 0x52,
182
183
  add: 0x7c,
183
184
  sub: 0x7d,
184
185
  mul: 0x7e,
185
186
  },
186
187
  f32: {
187
188
  const: 0x43,
189
+ ne: 0x5c,
188
190
  add: 0x92,
189
191
  sub: 0x93,
190
192
  mul: 0x94,
@@ -194,6 +196,7 @@ const instr = {
194
196
  load: 0x2b,
195
197
  store: 0x39,
196
198
  const: 0x44,
199
+ ne: 0x62,
197
200
  add: 0xa0,
198
201
  sub: 0xa1,
199
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.17",
4
+ "version": "0.2.18",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",