@parcel/graph 3.0.2-nightly.3042 → 3.0.3-nightly.3044
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 +8 -9
- package/package.json +2 -2
- package/src/BitSet.js +9 -14
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
|
-
//
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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) +
|
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.
|
3
|
+
"version": "3.0.3-nightly.3044+a1391ed8a",
|
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": "
|
25
|
+
"gitHead": "a1391ed8a719fc2f976dbadb528ca2dcffa7da12"
|
26
26
|
}
|
package/src/BitSet.js
CHANGED
@@ -1,18 +1,13 @@
|
|
1
1
|
// @flow strict-local
|
2
2
|
|
3
|
-
//
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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) +
|
93
|
+
fn((k << 5) + ctz32(v));
|
99
94
|
v ^= t;
|
100
95
|
}
|
101
96
|
}
|