@blackglory/structures 0.10.5 → 0.10.6

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.
@@ -16977,7 +16977,7 @@ class BitSet {
16977
16977
  for (let bit = 0; bit < BitSet.bitsPerElement; bit++) {
16978
16978
  const mask = this.getMask(bit);
16979
16979
  if ((element & mask) === mask) {
16980
- yield index * 8 + bit;
16980
+ yield index * BitSet.bitsPerElement + bit;
16981
16981
  }
16982
16982
  }
16983
16983
  }
@@ -16985,18 +16985,17 @@ class BitSet {
16985
16985
  for (let bit = 0; bit < remainder; bit++) {
16986
16986
  const mask = this.getMask(bit);
16987
16987
  if ((lastElement & mask) === mask) {
16988
- yield lastIndex * 8 + bit;
16988
+ yield lastIndex * BitSet.bitsPerElement + bit;
16989
16989
  }
16990
16990
  }
16991
16991
  }
16992
16992
  }
16993
16993
  _dumpBinaryStrings() {
16994
16994
  const result = [];
16995
- const expectedBinaryStringLength = Uint8Array.BYTES_PER_ELEMENT * 8;
16996
16995
  for (let i = 0; i < this.array.length; i++) {
16997
16996
  const binary = this.array.internalTypedArray[i].toString(2);
16998
- if (binary.length < expectedBinaryStringLength) {
16999
- result.push('0'.repeat(expectedBinaryStringLength - binary.length) + binary);
16997
+ if (binary.length < BitSet.bitsPerElement) {
16998
+ result.push('0'.repeat(BitSet.bitsPerElement - binary.length) + binary);
17000
16999
  }
17001
17000
  else {
17002
17001
  result.push(binary);
@@ -17006,7 +17005,7 @@ class BitSet {
17006
17005
  }
17007
17006
  has(value) {
17008
17007
  var _a;
17009
- const { index, mask } = this.getPosition(value);
17008
+ const [index, mask] = this.getPosition(value);
17010
17009
  return (((_a = this.array.get(index)) !== null && _a !== void 0 ? _a : 0) & mask) === mask;
17011
17010
  }
17012
17011
  add(value) {
@@ -17015,12 +17014,12 @@ class BitSet {
17015
17014
  if (value >= this.length) {
17016
17015
  this.length = value + 1;
17017
17016
  }
17018
- const { index, mask } = this.getPosition(value);
17017
+ const [index, mask] = this.getPosition(value);
17019
17018
  this.array.set(index, ((_a = this.array.get(index)) !== null && _a !== void 0 ? _a : 0) | mask);
17020
17019
  }
17021
17020
  delete(value) {
17022
17021
  var _a;
17023
- const { index, mask } = this.getPosition(value);
17022
+ const [index, mask] = this.getPosition(value);
17024
17023
  this.array.set(index, ((_a = this.array.get(index)) !== null && _a !== void 0 ? _a : 0) & ~mask);
17025
17024
  }
17026
17025
  clear() {
@@ -17033,7 +17032,7 @@ class BitSet {
17033
17032
  const quotient = (value - remainder) / BitSet.bitsPerElement;
17034
17033
  const index = quotient;
17035
17034
  const mask = this.getMask(remainder);
17036
- return { index, mask };
17035
+ return [index, mask];
17037
17036
  }
17038
17037
  // 输入一定是一个小于bitsPerElement的值, 取值范围是[0, bitsPerElement)
17039
17038
  getMask(value) {