@parcel/graph 3.0.2-nightly.3042 → 3.0.2

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/lib/BitSet.js CHANGED
@@ -4,14 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.BitSet = void 0;
7
- // Small wasm program that exposes the `ctz` instruction.
8
- // https://developer.mozilla.org/en-US/docs/WebAssembly/Reference/Numeric/Count_trailing_zeros
9
- const wasmBuf = new Uint8Array([0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x06, 0x01, 0x60, 0x01, 0x7f, 0x01, 0x7f, 0x03, 0x02, 0x01, 0x00, 0x07, 0x0d, 0x01, 0x09, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x30, 0x00, 0x00, 0x0a, 0x07, 0x01, 0x05, 0x00, 0x20, 0x00, 0x68, 0x0b, 0x00, 0x0f, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x02, 0x08, 0x01, 0x00, 0x01, 0x00, 0x03, 0x6e, 0x75, 0x6d]);
10
-
11
- // eslint-disable-next-line
12
- const {
13
- trailing0
14
- } = new WebAssembly.Instance(new WebAssembly.Module(wasmBuf)).exports;
7
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32#implementing_count_leading_ones_and_beyond
8
+ function ctz32(n) {
9
+ if (n === 0) {
10
+ return 32;
11
+ }
12
+ return 31 - Math.clz32(n & -n);
13
+ }
15
14
  class BitSet {
16
15
  constructor(maxBits) {
17
16
  this.bits = new Uint32Array(Math.ceil(maxBits / 32));
@@ -72,7 +71,7 @@ class BitSet {
72
71
  while (v !== 0) {
73
72
  let t = (v & -v) >>> 0;
74
73
  // $FlowFixMe
75
- fn((k << 5) + trailing0(v));
74
+ fn((k << 5) + ctz32(v));
76
75
  v ^= t;
77
76
  }
78
77
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parcel/graph",
3
- "version": "3.0.2-nightly.3042+c45c296e2",
3
+ "version": "3.0.2",
4
4
  "description": "Blazing fast, zero configuration web application bundler",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -22,5 +22,5 @@
22
22
  "dependencies": {
23
23
  "nullthrows": "^1.1.1"
24
24
  },
25
- "gitHead": "c45c296e236c363b3d59366b987a5a7894f1bbb6"
25
+ "gitHead": "a1391ed8a719fc2f976dbadb528ca2dcffa7da12"
26
26
  }
package/src/BitSet.js CHANGED
@@ -1,18 +1,13 @@
1
1
  // @flow strict-local
2
2
 
3
- // Small wasm program that exposes the `ctz` instruction.
4
- // https://developer.mozilla.org/en-US/docs/WebAssembly/Reference/Numeric/Count_trailing_zeros
5
- const wasmBuf = new Uint8Array([
6
- 0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x06, 0x01, 0x60, 0x01,
7
- 0x7f, 0x01, 0x7f, 0x03, 0x02, 0x01, 0x00, 0x07, 0x0d, 0x01, 0x09, 0x74, 0x72,
8
- 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x30, 0x00, 0x00, 0x0a, 0x07, 0x01, 0x05,
9
- 0x00, 0x20, 0x00, 0x68, 0x0b, 0x00, 0x0f, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x02,
10
- 0x08, 0x01, 0x00, 0x01, 0x00, 0x03, 0x6e, 0x75, 0x6d,
11
- ]);
12
-
13
- // eslint-disable-next-line
14
- const {trailing0} = new WebAssembly.Instance(new WebAssembly.Module(wasmBuf))
15
- .exports;
3
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32#implementing_count_leading_ones_and_beyond
4
+ function ctz32(n: number): number {
5
+ if (n === 0) {
6
+ return 32;
7
+ }
8
+ let reversed = n & -n;
9
+ return 31 - Math.clz32(reversed);
10
+ }
16
11
 
17
12
  export class BitSet {
18
13
  bits: Uint32Array;
@@ -95,7 +90,7 @@ export class BitSet {
95
90
  while (v !== 0) {
96
91
  let t = (v & -v) >>> 0;
97
92
  // $FlowFixMe
98
- fn((k << 5) + trailing0(v));
93
+ fn((k << 5) + ctz32(v));
99
94
  v ^= t;
100
95
  }
101
96
  }